<!doctype html><html lang="en">
 <head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
  <meta content="#3c790a" name="theme-color">
  <title>URL Standard</title>
  <link crossorigin href="https://resources.whatwg.org/spec.css" rel="stylesheet">
  <link crossorigin href="https://resources.whatwg.org/standard.css" rel="stylesheet">
  <link crossorigin href="https://resources.whatwg.org/standard-shared-with-dev.css" rel="stylesheet">
  <link crossorigin href="https://resources.whatwg.org/logo-url.svg" rel="icon">
<script async crossorigin src="https://resources.whatwg.org/file-issue.js"></script>
<script async crossorigin src="https://resources.whatwg.org/commit-snapshot-shortcut-key.js"></script>
<style>/* style-dfn-panel */

.dfn-panel {
    position: absolute;
    z-index: 35;
    height: auto;
    width: -webkit-fit-content;
    width: fit-content;
    max-width: 300px;
    max-height: 500px;
    overflow: auto;
    padding: 0.5em 0.75em;
    font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
    background: #DDDDDD;
    color: black;
    border: outset 0.2em;
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: black; }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel ul { padding: 0; }
.dfn-panel li { list-style: inside; }
.dfn-panel.activated {
    display: inline-block;
    position: fixed;
    left: .5em;
    bottom: 2em;
    margin: 0 auto;
    max-width: calc(100vw - 1.5em - .4em - .5em);
    max-height: 30vh;
}

.dfn-paneled { cursor: pointer; }
</style>
 <body class="h-entry status-LS">
  <div class="head">
   <p data-fill-with="logo"><a class="logo" href="https://whatwg.org/"> <img alt="WHATWG" crossorigin height="100" src="https://resources.whatwg.org/logo-url.svg"> </a> </p>
   <hgroup>
    <h1 class="p-name no-ref allcaps" id="title">URL</h1>
    <h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Living Standard — Last Updated <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></span></h2>
   </hgroup>
   <div data-fill-with="spec-metadata">
    <dl>
     <dt>Participate:
     <dd><a href="https://github.com/whatwg/url">GitHub whatwg/url</a> (<a href="https://github.com/whatwg/url/issues/new">new issue</a>, <a href="https://github.com/whatwg/url/issues">open issues</a>)
     <dd><a href="https://wiki.whatwg.org/wiki/IRC">IRC: #whatwg on Freenode</a>
     <dt>Commits:
     <dd><a href="https://github.com/whatwg/url/commits">GitHub whatwg/url/commits</a>
     <dd>[SNAPSHOT-LINK]
     <dd><a href="https://twitter.com/urlstandard">@urlstandard</a>
     <dt>Tests:
     <dd><a href="https://github.com/web-platform-tests/wpt/tree/master/url">web-platform-tests url/</a> (<a href="https://github.com/web-platform-tests/wpt/labels/url">ongoing work</a>)
     <dt>Translations <small>(non-normative)</small>:
     <dd><span title="Japanese"><a href="https://triple-underscore.github.io/URL-ja.html" hreflang="ja" lang="ja" rel="alternate">日本語</a></span>
    </dl>
   </div>
   <div data-fill-with="warning"></div>
  </div>
  <div class="p-summary" data-fill-with="abstract">
   <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
   <p>The URL Standard defines URLs, domains, IP addresses, the <code>application/x-www-form-urlencoded</code> format, and their API.</p>
  </div>
  <nav data-fill-with="table-of-contents" id="toc">
   <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
   <ol class="toc" role="directory">
    <li><a href="#goals"><span class="secno"></span> <span class="content">Goals</span></a>
    <li>
     <a href="#infrastructure"><span class="secno">1</span> <span class="content">Infrastructure</span></a>
     <ol class="toc">
      <li><a href="#writing"><span class="secno">1.1</span> <span class="content">Writing</span></a>
      <li><a href="#parsers"><span class="secno">1.2</span> <span class="content">Parsers</span></a>
      <li><a href="#percent-encoded-bytes"><span class="secno">1.3</span> <span class="content">Percent-encoded bytes</span></a>
     </ol>
    <li><a href="#security-considerations"><span class="secno">2</span> <span class="content">Security considerations</span></a>
    <li>
     <a href="#hosts-(domains-and-ip-addresses)"><span class="secno">3</span> <span class="content">Hosts (domains and IP addresses)</span></a>
     <ol class="toc">
      <li><a href="#host-representation"><span class="secno">3.1</span> <span class="content">Host representation</span></a>
      <li><a href="#host-miscellaneous"><span class="secno">3.2</span> <span class="content">Host miscellaneous</span></a>
      <li><a href="#idna"><span class="secno">3.3</span> <span class="content">IDNA</span></a>
      <li><a href="#host-writing"><span class="secno">3.4</span> <span class="content">Host writing</span></a>
      <li><a href="#host-parsing"><span class="secno">3.5</span> <span class="content">Host parsing</span></a>
      <li><a href="#host-serializing"><span class="secno">3.6</span> <span class="content">Host serializing</span></a>
      <li><a href="#host-equivalence"><span class="secno">3.7</span> <span class="content">Host equivalence</span></a>
     </ol>
    <li>
     <a href="#urls"><span class="secno">4</span> <span class="content">URLs</span></a>
     <ol class="toc">
      <li><a href="#url-representation"><span class="secno">4.1</span> <span class="content">URL representation</span></a>
      <li><a href="#url-miscellaneous"><span class="secno">4.2</span> <span class="content">URL miscellaneous</span></a>
      <li><a href="#url-writing"><span class="secno">4.3</span> <span class="content">URL writing</span></a>
      <li><a href="#url-parsing"><span class="secno">4.4</span> <span class="content">URL parsing</span></a>
      <li><a href="#url-serializing"><span class="secno">4.5</span> <span class="content">URL serializing</span></a>
      <li><a href="#url-equivalence"><span class="secno">4.6</span> <span class="content">URL equivalence</span></a>
      <li><a href="#origin"><span class="secno">4.7</span> <span class="content">Origin</span></a>
      <li>
       <a href="#url-rendering"><span class="secno">4.8</span> <span class="content">URL rendering</span></a>
       <ol class="toc">
        <li><a href="#url-rendering-simplification"><span class="secno">4.8.1</span> <span class="content">Simplify non-human-readable or irrelevant components</span></a>
        <li><a href="#url-rendering-elision"><span class="secno">4.8.2</span> <span class="content">Elision</span></a>
        <li><a href="#url-rendering-i18n"><span class="secno">4.8.3</span> <span class="content">Internationalization and special characters</span></a>
       </ol>
     </ol>
    <li>
     <a href="#application/x-www-form-urlencoded"><span class="secno">5</span> <span class="content"><code>application/x-www-form-urlencoded</code></span></a>
     <ol class="toc">
      <li><a href="#urlencoded-parsing"><span class="secno">5.1</span> <span class="content"><code>application/x-www-form-urlencoded</code> parsing</span></a>
      <li><a href="#urlencoded-serializing"><span class="secno">5.2</span> <span class="content"><code>application/x-www-form-urlencoded</code> serializing</span></a>
      <li><a href="#urlencoded-hooks"><span class="secno">5.3</span> <span class="content">Hooks</span></a>
     </ol>
    <li>
     <a href="#api"><span class="secno">6</span> <span class="content">API</span></a>
     <ol class="toc">
      <li><a href="#url-class"><span class="secno">6.1</span> <span class="content">URL class</span></a>
      <li><a href="#interface-urlsearchparams"><span class="secno">6.2</span> <span class="content">URLSearchParams class</span></a>
      <li><a href="#url-apis-elsewhere"><span class="secno">6.3</span> <span class="content">URL APIs elsewhere</span></a>
     </ol>
    <li><a href="#acknowledgments"><span class="secno"></span> <span class="content">Acknowledgments</span></a>
    <li>
     <a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
     <ol class="toc">
      <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
      <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
     </ol>
    <li>
     <a href="#references"><span class="secno"></span> <span class="content">References</span></a>
     <ol class="toc">
      <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
      <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
     </ol>
    <li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a>
   </ol>
  </nav>
  <main>
   <h2 class="no-num heading settled" id="goals"><span class="content">Goals</span></h2>
   <p>The URL standard takes the following approach towards making URLs fully interoperable: </p>
   <ul>
    <li>
     <p>Align RFC 3986 and RFC 3987 with contemporary implementations and
 obsolete them in the process. (E.g., spaces, other "illegal" code points,
 query encoding, equality, canonicalization, are all concepts not entirely
 shared, or defined.) URL parsing needs to become as solid as HTML parsing. <a data-link-type="biblio" href="#biblio-rfc3986">[RFC3986]</a> <a data-link-type="biblio" href="#biblio-rfc3987">[RFC3987]</a> </p>
    <li>
     <p>Standardize on the term URL. URI and IRI are just confusing. In
 practice a single algorithm is used for both so keeping them distinct is
 not helping anyone. URL also easily wins the <a href="https://trends.google.com/trends/explore?q=url,uri">search result popularity contest</a>. </p>
    <li>
     <p>Supplanting <a href="https://tools.ietf.org/html/rfc6454#section-4">Origin of a URI [sic]</a>. <a data-link-type="biblio" href="#biblio-rfc6454">[RFC6454]</a> </p>
    <li>
     <p>Define URL’s existing JavaScript API in full detail and add
 enhancements to make it easier to work with. Add a new <code><a class="idl-code" data-link-type="interface" href="#url" id="ref-for-url">URL</a></code> object as well for URL manipulation without usage of HTML elements. (Useful
 for JavaScript worker environments.) </p>
    <li>
     <p>Ensure the combination of parser, serializer, and API guarantee idempotence. For example, a
 non-failure result of a parse-then-serialize operation will not change with any further
 parse-then-serialize operations applied to it. Similarly, manipulating a non-failure result through
 the API will not change from applying any number of serialize-then-parse operations to it. </p>
   </ul>
   <p class="note" role="note">As the editors learn more about the subject matter the goals
might increase in scope somewhat. </p>
   <h2 class="heading settled" data-level="1" id="infrastructure"><span class="secno">1. </span><span class="content">Infrastructure</span><a class="self-link" href="#infrastructure"></a></h2>
   <p>This specification depends on the Infra Standard. <a data-link-type="biblio" href="#biblio-infra">[INFRA]</a> </p>
   <p>Some terms used in this specification are defined in the following standards and specifications: </p>
   <ul class="brief">
    <li>DOM Standard <a data-link-type="biblio" href="#biblio-dom">[DOM]</a> 
    <li>Encoding Standard <a data-link-type="biblio" href="#biblio-encoding">[ENCODING]</a> 
    <li>File API <a data-link-type="biblio" href="#biblio-fileapi">[FILEAPI]</a> 
    <li>HTML Standard <a data-link-type="biblio" href="#biblio-html">[HTML]</a> 
    <li>Media Source Extensions <a data-link-type="biblio" href="#biblio-media-source">[MEDIA-SOURCE]</a> 
    <li>Unicode IDNA Compatibility Processing <a data-link-type="biblio" href="#biblio-uts46">[UTS46]</a> 
    <li>Web IDL <a data-link-type="biblio" href="#biblio-webidl">[WEBIDL]</a> 
   </ul>
   <hr>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="serialize-an-integer">serialize an integer</dfn>, represent it as the shortest possible decimal
number. </p>
   <h3 class="heading settled" data-level="1.1" id="writing"><span class="secno">1.1. </span><span class="content">Writing</span><a class="self-link" href="#writing"></a></h3>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="validation-error">validation error<span id="syntax-violation"></span></dfn> indicates a mismatch between input and
valid input. User agents, especially conformance checkers, are encouraged to report them somewhere. </p>
   <div class="note no-backref" role="note">
    <p>A <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error">validation error</a> does not mean that the parser terminates. Termination of a parser is
 always stated explicitly, e.g., through a return statement. </p>
    <p>It is useful to signal <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error①">validation errors</a> as error-handling can be non-intuitive, legacy
 user agents might not implement correct error-handling, and the intent of what is written might be
 unclear to other developers. </p>
   </div>
   <h3 class="heading settled" data-level="1.2" id="parsers"><span class="secno">1.2. </span><span class="content">Parsers</span><a class="self-link" href="#parsers"></a></h3>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="eof-code-point">EOF code point</dfn> is a conceptual code point that signifies the end of a
string or code point stream. </p>
   <p>Within a parser algorithm that uses a <var>pointer</var> variable, <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="c">c</dfn> references the code point the <var>pointer</var> variable points to. </p>
   <p>Within a string-based parser algorithm that uses a <var>pointer</var> variable, <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="remaining">remaining</dfn> references the substring after <var>pointer</var> in the string
being processed. </p>
   <p class="example" id="example-12672b6a"><a class="self-link" href="#example-12672b6a"></a>If "<code>mailto:username@example</code>" is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string" id="ref-for-string">string</a> being processed and <var>pointer</var> points to @, <a data-link-type="dfn" href="#c" id="ref-for-c">c</a> is U+0040 (@) and <a data-link-type="dfn" href="#remaining" id="ref-for-remaining">remaining</a> is
"<code>example</code>". </p>
   <h3 class="heading settled" data-level="1.3" id="percent-encoded-bytes"><span class="secno">1.3. </span><span class="content">Percent-encoded bytes</span><a class="self-link" href="#percent-encoded-bytes"></a></h3>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="percent-encoded-byte">percent-encoded byte</dfn> is U+0025 (%), followed by two <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-hex-digit" id="ref-for-ascii-hex-digit">ASCII hex digits</a>.
Sequences of <a data-link-type="dfn" href="#percent-encoded-byte" id="ref-for-percent-encoded-byte">percent-encoded bytes</a>, after conversion to bytes,
should not cause <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-decode-without-bom-or-fail" id="ref-for-utf-8-decode-without-bom-or-fail">UTF-8 decode without BOM or fail</a> to return failure. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="percent-encode">percent encode</dfn> a <var>byte</var> into a <a data-link-type="dfn" href="#percent-encoded-byte" id="ref-for-percent-encoded-byte①">percent-encoded byte</a>, return
a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string" id="ref-for-string①">string</a> consisting of U+0025 (%), followed by two <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-upper-hex-digit" id="ref-for-ascii-upper-hex-digit">ASCII upper hex digits</a> representing <var>byte</var>. </p>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="percent-decode">percent decode</dfn> a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence">byte sequence</a> <var>input</var>, run these steps: </p>
   <p class="warning">Using anything but <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-decode-without-bom" id="ref-for-utf-8-decode-without-bom">UTF-8 decode without BOM</a> when the <var>input</var> contains bytes that are not <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-byte" id="ref-for-ascii-byte">ASCII bytes</a> might be insecure and is not recommended. </p>
   <ol>
    <li>
     <p>Let <var>output</var> be an empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#byte-sequence" id="ref-for-byte-sequence①">byte sequence</a>. </p>
    <li>
     <p>For each byte <var>byte</var> in <var>input</var>: </p>
     <ol>
      <li>
       <p>If <var>byte</var> is not 0x25 (%), then append <var>byte</var> to <var>output</var>. </p>
      <li>
       <p>Otherwise, if <var>byte</var> is 0x25 (%) and the next two bytes after <var>byte</var> in <var>input</var> are not in the ranges 0x30 (0) to 0x39 (9),
   0x41 (A) to 0x46 (F), and 0x61 (a) to 0x66 (f), all inclusive, append <var>byte</var> to <var>output</var>. </p>
      <li>
       <p>Otherwise: </p>
       <ol>
        <li>
         <p>Let <var>bytePoint</var> be the two bytes after <var>byte</var> in <var>input</var>, <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-decode-without-bom" id="ref-for-utf-8-decode-without-bom①">decoded</a>, and then interpreted as hexadecimal number. </p>
        <li>
         <p>Append a byte whose value is <var>bytePoint</var> to <var>output</var>. </p>
        <li>
         <p>Skip the next two bytes in <var>input</var>. </p>
       </ol>
     </ol>
    <li>
     <p>Return <var>output</var>. </p>
   </ol>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="string-percent-decode">string percent decode</dfn> a string <var>input</var>, run these steps: </p>
   <ol>
    <li>
     <p>Let <var>bytes</var> be the <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-encode" id="ref-for-utf-8-encode">UTF-8 encoding</a> of <var>input</var>. </p>
    <li>
     <p>Return the <a data-link-type="dfn" href="#percent-decode" id="ref-for-percent-decode">percent decoding</a> of <var>bytes</var>. </p>
   </ol>
   <hr>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="c0-control-percent-encode-set">C0 control percent-encode set<span id="simple-encode-set"></span></dfn> are the <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#c0-control" id="ref-for-c0-control">C0 controls</a> and all <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point">code points</a> greater than U+007E (~). </p>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="fragment-percent-encode-set">fragment percent-encode set</dfn> is the <a data-link-type="dfn" href="#c0-control-percent-encode-set" id="ref-for-c0-control-percent-encode-set">C0 control percent-encode set</a> and
U+0020 SPACE, U+0022 ("), U+003C (&lt;), U+003E (>), and U+0060 (`). </p>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="path-percent-encode-set">path percent-encode set<span id="default-encode-set"></span></dfn> is the <a data-link-type="dfn" href="#fragment-percent-encode-set" id="ref-for-fragment-percent-encode-set">fragment percent-encode set</a> and U+0023 (#), U+003F (?), U+007B ({), and U+007D (}). </p>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="userinfo-percent-encode-set">userinfo percent-encode set<span id="userinfo-encode-set"></span></dfn> is the <a data-link-type="dfn" href="#path-percent-encode-set" id="ref-for-path-percent-encode-set">path percent-encode set</a> and U+002F (/), U+003A (:), U+003B (;), U+003D (=), U+0040 (@),
U+005B ([), U+005C (\), U+005D (]), U+005E (^), and U+007C (|). </p>
   <p>To <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="utf-8-percent-encode">UTF-8 percent encode</dfn> a <var>codePoint</var>, using a <var>percentEncodeSet</var>,
run these steps: </p>
   <ol>
    <li>
     <p>If <var>codePoint</var> is not in <var>percentEncodeSet</var>, then return <var>codePoint</var>. </p>
    <li>
     <p>Let <var>bytes</var> be the result of running <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-encode" id="ref-for-utf-8-encode①">UTF-8 encode</a> on <var>codePoint</var>. </p>
    <li>
     <p><a data-link-type="dfn" href="#percent-encode" id="ref-for-percent-encode">Percent encode</a> each byte in <var>bytes</var>, and then return the results
 concatenated, in the same order. </p>
   </ol>
   <h2 class="heading settled" data-level="2" id="security-considerations"><span class="secno">2. </span><span class="content">Security considerations</span><a class="self-link" href="#security-considerations"></a></h2>
   <p>The security of a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url">URL</a> is a function of its environment. Care is to be
taken when rendering, interpreting, and passing <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url①">URLs</a> around. </p>
   <p>When rendering and allocating new <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url②">URLs</a> "spoofing" needs to be considered. An attack
whereby one <a data-link-type="dfn" href="#concept-host" id="ref-for-concept-host">host</a> or <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url③">URL</a> can be confused for another. For instance,
consider how 1/l/I, m/rn/rri, 0/O, and а/a can all appear eerily similar. Or worse, consider how
U+202A LEFT-TO-RIGHT EMBEDDING and similar <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point①">code points</a> are invisible. <a data-link-type="biblio" href="#biblio-utr36">[UTR36]</a> </p>
   <p>When passing a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url④">URL</a> from party <var>A</var> to <var>B</var>, both need to
carefully consider what is happening. <var>A</var> might end up leaking data it does not
want to leak. <var>B</var> might receive input it did not expect and take an action that
harms the user. In particular, <var>B</var> should never trust <var>A</var>, as at some
point <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑤">URLs</a> from <var>A</var> can come from untrusted sources. </p>
   <h2 class="heading settled" data-level="3" id="hosts-(domains-and-ip-addresses)"><span class="secno">3. </span><span class="content">Hosts (domains and IP addresses)</span><a class="self-link" href="#hosts-(domains-and-ip-addresses)"></a></h2>
   <p>At a high level, a <a data-link-type="dfn" href="#concept-host" id="ref-for-concept-host①">host</a>, <a data-link-type="dfn" href="#valid-host-string" id="ref-for-valid-host-string">valid host string</a>, <a data-link-type="dfn" href="#concept-host-parser" id="ref-for-concept-host-parser">host parser</a>, and <a data-link-type="dfn" href="#concept-host-serializer" id="ref-for-concept-host-serializer">host serializer</a> relate as follows: </p>
   <ul>
    <li>
     <p>The <a data-link-type="dfn" href="#concept-host-parser" id="ref-for-concept-host-parser①">host parser</a> takes an arbitrary string and returns either failure or a <a data-link-type="dfn" href="#concept-host" id="ref-for-concept-host②">host</a>. </p>
    <li>
     <p>A <a data-link-type="dfn" href="#concept-host" id="ref-for-concept-host③">host</a> can be seen as the in-memory representation. </p>
    <li>
     <p>A <a data-link-type="dfn" href="#valid-host-string" id="ref-for-valid-host-string①">valid host string</a> defines what input would not trigger a <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error②">validation error</a> or failure when given to the <a data-link-type="dfn" href="#concept-host-parser" id="ref-for-concept-host-parser②">host parser</a>. I.e., input that would be considered conforming or
 valid. </p>
    <li>
     <p>The <a data-link-type="dfn" href="#concept-host-serializer" id="ref-for-concept-host-serializer①">host serializer</a> takes a <a data-link-type="dfn" href="#concept-host" id="ref-for-concept-host④">host</a> and returns a string. (If that string
 is then <a data-link-type="dfn" href="#concept-host-parser" id="ref-for-concept-host-parser③">parsed</a>, the result will <a data-link-type="dfn" href="#concept-host-equals" id="ref-for-concept-host-equals">equal</a> the <a data-link-type="dfn" href="#concept-host" id="ref-for-concept-host⑤">host</a> that was <a data-link-type="dfn" href="#concept-host-serializer" id="ref-for-concept-host-serializer②">serialized</a>.) </p>
   </ul>
   <h3 class="heading settled" data-level="3.1" id="host-representation"><span class="secno">3.1. </span><span class="content">Host representation</span><a class="self-link" href="#host-representation"></a></h3>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="concept-host">host</dfn> is a <a data-link-type="dfn" href="#concept-domain" id="ref-for-concept-domain">domain</a>, an <a data-link-type="dfn" href="#concept-ipv4" id="ref-for-concept-ipv4">IPv4 address</a>, an <a data-link-type="dfn" href="#concept-ipv6" id="ref-for-concept-ipv6">IPv6 address</a>, an <a data-link-type="dfn" href="#opaque-host" id="ref-for-opaque-host">opaque host</a>, or an <a data-link-type="dfn" href="#empty-host" id="ref-for-empty-host">empty host</a>.
Typically a <a data-link-type="dfn" href="#concept-host" id="ref-for-concept-host⑥">host</a> serves as a network address, but it is sometimes used as opaque
identifier in <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑥">URLs</a> where a network address is not necessary. </p>
   <p class="note" role="note">The RFCs referenced in the paragraphs below are for informative purposes only. They
have no influence on <a data-link-type="dfn" href="#concept-host" id="ref-for-concept-host⑦">host</a> writing, parsing, and serialization. Unless stated otherwise
in the sections that follow. </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="concept-domain">domain</dfn> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-string" id="ref-for-ascii-string">ASCII string</a> that identifies a realm
within a network. <a data-link-type="biblio" href="#biblio-rfc1034">[RFC1034]</a> </p>
   <p class="note" role="note">The <code>example.com</code> and <code>example.com.</code> <a data-link-type="dfn" href="#concept-domain" id="ref-for-concept-domain①">domains</a> are
not equivalent and typically treated as distinct. </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="concept-ipv4">IPv4 address</dfn> is a 32-bit unsigned integer that identifies a
network address. <a data-link-type="biblio" href="#biblio-rfc791">[RFC791]</a> </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="concept-ipv6">IPv6 address</dfn> is a 128-bit unsigned integer that identifies a
network address. For the purposes of this standard it is represented as a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list">list</a> of eight
16-bit unsigned integers, also known as <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="IPv6 piece" id="concept-ipv6-piece">IPv6 pieces</dfn>. <a data-link-type="biblio" href="#biblio-rfc4291">[RFC4291]</a> </p>
   <p class="note" role="note">Support for <code>&lt;zone_id></code> is <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=27234#c2">intentionally omitted</a>. </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="opaque-host">opaque host</dfn> is a non-empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-string" id="ref-for-ascii-string①">ASCII string</a> holding data that can be used
for further processing. </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="empty-host">empty host</dfn> is the empty string. </p>
   <h3 class="heading settled" data-level="3.2" id="host-miscellaneous"><span class="secno">3.2. </span><span class="content">Host miscellaneous</span><a class="self-link" href="#host-miscellaneous"></a></h3>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="forbidden-host-code-point">forbidden host code point</dfn> is U+0000 NULL, U+0009 TAB, U+000A LF, U+000D CR,
U+0020 SPACE, U+0023 (#), U+0025 (%), U+002F (/), U+003A (:), U+003F (?), U+0040 (@), U+005B ([),
U+005C (\), or U+005D (]). </p>
   <p>A <a data-link-type="dfn" href="#concept-host" id="ref-for-concept-host⑧">host</a>’s <dfn class="dfn-paneled" data-dfn-for="host" data-dfn-type="dfn" data-export id="host-public-suffix">public suffix</dfn> is the portion of a <a data-link-type="dfn" href="#concept-host" id="ref-for-concept-host⑨">host</a> which is included on the <cite>Public Suffix List</cite>. To obtain <var>host</var>’s <a data-link-type="dfn" href="#host-public-suffix" id="ref-for-host-public-suffix">public suffix</a>, run these steps: <a data-link-type="biblio" href="#biblio-psl">[PSL]</a> </p>
   <ol>
    <li>
     <p>If <var>host</var> is not a <a data-link-type="dfn" href="#concept-domain" id="ref-for-concept-domain②">domain</a>, then return null. </p>
    <li>
     <p>Return the <a data-link-type="dfn" href="#host-public-suffix" id="ref-for-host-public-suffix①">public suffix</a> obtained by executing the <a href="https://publicsuffix.org/list/">algorithm</a> defined by the Public Suffix List on <var>host</var>. <a data-link-type="biblio" href="#biblio-psl">[PSL]</a>. </p>
   </ol>
   <p>A <a data-link-type="dfn" href="#concept-host" id="ref-for-concept-host①⓪">host</a>’s <dfn class="dfn-paneled" data-dfn-for="host" data-dfn-type="dfn" data-export id="host-registrable-domain">registrable domain</dfn> is a <a data-link-type="dfn" href="#concept-domain" id="ref-for-concept-domain③">domain</a> formed by
the most specific public suffix, along with the domain label immediately preceeding it, if any. To
obtain <var>host</var>’s <a data-link-type="dfn" href="#host-registrable-domain" id="ref-for-host-registrable-domain">registrable domain</a>, run these steps: </p>
   <ol>
    <li>
     <p>If <var>host</var>’s <a data-link-type="dfn" href="#host-public-suffix" id="ref-for-host-public-suffix②">public suffix</a> is null or <var>host</var>’s <a data-link-type="dfn" href="#host-public-suffix" id="ref-for-host-public-suffix③">public suffix</a> <a data-link-type="dfn" href="#concept-host-equals" id="ref-for-concept-host-equals①">equals</a> <var>host</var>, then return null. </p>
    <li>
     <p>Return the <a data-link-type="dfn" href="#host-registrable-domain" id="ref-for-host-registrable-domain①">registrable domain</a> obtained by executing the <a href="https://publicsuffix.org/list/">algorithm</a> defined by the Public Suffix List on <var>host</var>. <a data-link-type="biblio" href="#biblio-psl">[PSL]</a> </p>
   </ol>
   <div class="example" id="example-host-psl">
    <a class="self-link" href="#example-host-psl"></a> 
    <table>
     <tbody>
      <tr>
       <th>Host input 
       <th>Public suffix 
       <th>Registrable domain 
      <tr>
       <td><code>com</code> 
       <td><code>com</code> 
       <td><i>null</i> 
      <tr>
       <td><code>example.com</code> 
       <td><code>com</code> 
       <td><code>example.com</code> 
      <tr>
       <td><code>www.example.com</code> 
       <td><code>com</code> 
       <td><code>example.com</code> 
      <tr>
       <td><code>sub.www.example.com</code> 
       <td><code>com</code> 
       <td><code>example.com</code> 
      <tr>
       <td><code>EXAMPLE.COM</code> 
       <td><code>com</code> 
       <td><code>example.com</code> 
      <tr>
       <td><code>github.io</code> 
       <td><code>github.io</code> 
       <td><i>null</i> 
      <tr>
       <td><code>whatwg.github.io</code> 
       <td><code>github.io</code> 
       <td><code>whatwg.github.io</code> 
      <tr>
       <td><code>إختبار</code> 
       <td><code>xn-kgbechtv</code> 
       <td><i>null</i> 
      <tr>
       <td><code>example.إختبار</code> 
       <td><code>xn-kgbechtv</code> 
       <td><code>example.xn-kgbechtv</code> 
      <tr>
       <td><code>sub.example.إختبار</code> 
       <td><code>xn-kgbechtv</code> 
       <td><code>example.xn-kgbechtv</code> 
    </table>
   </div>
   <p class="warning" id="warning-avoid-psl">Specifications should prefer the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin" id="ref-for-concept-origin">origin</a> concept
for security decisions. The notion of "<a data-link-type="dfn" href="#host-public-suffix" id="ref-for-host-public-suffix④">public suffix</a>" and
"<a data-link-type="dfn" href="#host-registrable-domain" id="ref-for-host-registrable-domain②">registrable domain</a>" cannot be relied-upon to provide a hard security boundary, as
the public suffix list will diverge from client to client. Specifications which ignore this advice
are encouraged to carefully consider whether URLs' schemes ought to be incorporated into any
decisions made, i.e. whether to use the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#same-site" id="ref-for-same-site">same site</a> or <a data-link-type="dfn">schemelessly same site</a> concepts. </p>
   <h3 class="heading settled" data-level="3.3" id="idna"><span class="secno">3.3. </span><span class="content">IDNA</span><a class="self-link" href="#idna"></a></h3>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="concept-domain-to-ascii">domain to ASCII</dfn> algorithm, given a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string" id="ref-for-string②">string</a> <var>domain</var> and optionally a boolean <var>beStrict</var>, runs these steps: </p>
   <ol>
    <li>
     <p>If <var>beStrict</var> is not given, set it to false. </p>
    <li>
     <p>Let <var>result</var> be the result of running <a data-link-type="abstract-op" href="https://www.unicode.org/reports/tr46/#ToASCII" id="ref-for-ToASCII">Unicode ToASCII</a> with <i>domain_name</i> set to <var>domain</var>, <i>UseSTD3ASCIIRules</i> set to <var>beStrict</var>, <i>CheckHyphens</i> set to false, <i>CheckBidi</i> set to true, <i>CheckJoiners</i> set to true, <i>Transitional_Processing</i> set to false,
 and <i>VerifyDnsLength</i> set to <var>beStrict</var>. </p>
    <li>
     <p>If <var>result</var> is a failure value, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error③">validation error</a>, return failure. </p>
    <li>
     <p>Return <var>result</var>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="concept-domain-to-unicode">domain to Unicode</dfn> algorithm, given a <a data-link-type="dfn" href="#concept-domain" id="ref-for-concept-domain④">domain</a> <var>domain</var>, runs these steps: </p>
   <ol>
    <li>
     <p>Let <var>result</var> be the result of running <a data-link-type="abstract-op" href="https://www.unicode.org/reports/tr46/#ToUnicode" id="ref-for-ToUnicode">Unicode ToUnicode</a> with <i>domain_name</i> set to <var>domain</var>, <i>CheckHyphens</i> set to false, <i>CheckBidi</i> set to true, <i>CheckJoiners</i> set to true, <i>UseSTD3ASCIIRules</i> set to false, and <i>Transitional_Processing</i> set to false. </p>
    <li>
     <p>Signify <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error④">validation errors</a> for any returned errors, and then, return <var>result</var>. </p>
   </ol>
   <h3 class="heading settled" data-level="3.4" id="host-writing"><span class="secno">3.4. </span><span class="content">Host writing</span><span id="host-syntax"></span><a class="self-link" href="#host-writing"></a></h3>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="valid-host-string">valid host string<span id="syntax-host"></span></dfn> must be a <a data-link-type="dfn" href="#valid-domain-string" id="ref-for-valid-domain-string">valid domain string</a>, a <a data-link-type="dfn" href="#valid-ipv4-address-string" id="ref-for-valid-ipv4-address-string">valid IPv4-address string</a>, or: U+005B ([), followed by a <a data-link-type="dfn" href="#valid-ipv6-address-string" id="ref-for-valid-ipv6-address-string">valid IPv6-address string</a>, followed by U+005D (]). </p>
   <p>A <var>domain</var> is a <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="valid-domain">valid domain</dfn> if these steps return success: </p>
   <ol>
    <li>
     <p>Let <var>result</var> be the result of running <a data-link-type="dfn" href="#concept-domain-to-ascii" id="ref-for-concept-domain-to-ascii">domain to ASCII</a> with <var>domain</var> and true. </p>
    <li>
     <p>If <var>result</var> is failure, then return failure. </p>
    <li>
     <p>Set <var>result</var> to the result of running <a data-link-type="abstract-op" href="https://www.unicode.org/reports/tr46/#ToUnicode" id="ref-for-ToUnicode①">Unicode ToUnicode</a> with <i>domain_name</i> set to <var>result</var>, <i>CheckHyphens</i> set to false, <i>CheckBidi</i> set to true, <i>CheckJoiners</i> set to true, <i>UseSTD3ASCIIRules</i> set to true, and <i>Transitional_Processing</i> set to false. </p>
    <li>
     <p>If <var>result</var> contains any errors, return failure. </p>
    <li>
     <p>Return success. </p>
   </ol>
   <p class="XXX">Ideally we define this in terms of a sequence of code points that make up a <a data-link-type="dfn" href="#valid-domain" id="ref-for-valid-domain">valid domain</a> rather than through a whack-a-mole: <a href="https://github.com/whatwg/url/issues/245">issue 245</a>. </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="valid-domain-string">valid domain string<span id="syntax-host-domain"></span></dfn> must be a string that is a <a data-link-type="dfn" href="#valid-domain" id="ref-for-valid-domain①">valid domain</a>. </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="valid-ipv4-address-string">valid IPv4-address string<span id="syntax-host-ipv4"></span></dfn> must be four sequences of
up to three <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-digit" id="ref-for-ascii-digit">ASCII digits</a> per sequence, each representing a decimal number no greater than
255, and separated from each other by U+002E (.). </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="valid-ipv6-address-string">valid IPv6-address string<span id="syntax-host-ipv6"></span></dfn> is defined in the <a href="https://tools.ietf.org/html/rfc4291#section-2.2">"Text Representation of Addresses" chapter of IP Version 6 Addressing Architecture</a>. <a data-link-type="biblio" href="#biblio-rfc4291">[RFC4291]</a> </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="valid-opaque-host-string">valid opaque-host string</dfn> must be one or more <a data-link-type="dfn" href="#url-units" id="ref-for-url-units">URL units</a> or: U+005B ([),
followed by a <a data-link-type="dfn" href="#valid-ipv6-address-string" id="ref-for-valid-ipv6-address-string①">valid IPv6-address string</a>, followed by U+005D (]). </p>
   <p class="note no-backref" role="note">This is not part of the definition of <a data-link-type="dfn" href="#valid-host-string" id="ref-for-valid-host-string②">valid host string</a> as it
requires context to be distinguished. </p>
   <h3 class="heading settled" data-level="3.5" id="host-parsing"><span class="secno">3.5. </span><span class="content">Host parsing</span><a class="self-link" href="#host-parsing"></a></h3>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="host parser|host parsing" id="concept-host-parser">host parser</dfn> takes a
string <var>input</var> with an optional boolean <var>isNotSpecial</var>, and then runs these steps: </p>
   <ol>
    <li>
     <p>If <var>isNotSpecial</var> is not given, then set <var>isNotSpecial</var> to false. </p>
    <li>
     <p>If <var>input</var> starts with U+005B ([), then: </p>
     <ol>
      <li>
       <p>If <var>input</var> does not end with U+005D (]), <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑤">validation error</a>, return failure. </p>
      <li>
       <p>Return the result of <a data-link-type="dfn" href="#concept-ipv6-parser" id="ref-for-concept-ipv6-parser">IPv6 parsing</a> <var>input</var> with its
   leading U+005B ([) and trailing U+005D (]) removed. </p>
     </ol>
    <li>
     <p>If <var>isNotSpecial</var> is true, then return the result of <a data-link-type="dfn" href="#concept-opaque-host-parser" id="ref-for-concept-opaque-host-parser">opaque-host parsing</a> <var>input</var>. </p>
    <li>
     <p>Let <var>domain</var> be the result of running <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-decode-without-bom" id="ref-for-utf-8-decode-without-bom②">UTF-8 decode without BOM</a> on the <a data-link-type="dfn" href="#string-percent-decode" id="ref-for-string-percent-decode">string percent decoding</a> of <var>input</var>. </p>
     <p class="note no-backref" role="note">Alternatively <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-decode-without-bom-or-fail" id="ref-for-utf-8-decode-without-bom-or-fail①">UTF-8 decode without BOM or fail</a> can be used,
  coupled with an early return for failure, as <a data-link-type="dfn" href="#concept-domain-to-ascii" id="ref-for-concept-domain-to-ascii①">domain to ASCII</a> fails on
  U+FFFD REPLACEMENT CHARACTER. </p>
    <li>
     <p>Let <var>asciiDomain</var> be the result of running <a data-link-type="dfn" href="#concept-domain-to-ascii" id="ref-for-concept-domain-to-ascii②">domain to ASCII</a> on <var>domain</var>. </p>
    <li>
     <p>If <var>asciiDomain</var> is failure, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑥">validation error</a>, return failure. </p>
    <li>
     <p>If <var>asciiDomain</var> contains a <a data-link-type="dfn" href="#forbidden-host-code-point" id="ref-for-forbidden-host-code-point">forbidden host code point</a>, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑦">validation error</a>, return failure. </p>
    <li>
     <p>Let <var>ipv4Host</var> be the result of <a data-link-type="dfn" href="#concept-ipv4-parser" id="ref-for-concept-ipv4-parser">IPv4 parsing</a> <var>asciiDomain</var>. </p>
    <li>
     <p>If <var>ipv4Host</var> is an <a data-link-type="dfn" href="#concept-ipv4" id="ref-for-concept-ipv4①">IPv4 address</a> or failure, return <var>ipv4Host</var>. </p>
    <li>
     <p>Return <var>asciiDomain</var>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="ipv4-number-parser">IPv4 number parser</dfn> takes a string <var>input</var> and a <var>validationErrorFlag</var> pointer, and then runs these steps: </p>
   <ol>
    <li>
     <p>Let <var>R</var> be 10. </p>
    <li>
     <p>If <var>input</var> contains at least two code points and the first two code points are either
  "<code>0x</code>" or "<code>0X</code>", then: </p>
     <ol>
      <li>
       <p>Set <var>validationErrorFlag</var>. </p>
      <li>
       <p>Remove the first two code points from <var>input</var>. </p>
      <li>
       <p>Set <var>R</var> to 16. </p>
     </ol>
    <li>
     <p>Otherwise, if <var>input</var> contains at least two code points and the first code point is
  U+0030 (0), then: </p>
     <ol>
      <li>
       <p>Set <var>validationErrorFlag</var>. </p>
      <li>
       <p>Remove the first code point from <var>input</var>. </p>
      <li>
       <p>Set <var>R</var> to 8. </p>
     </ol>
    <li>
     <p>If <var>input</var> is the empty string, then return zero. </p>
    <li>
     <p>If <var>input</var> contains a code point that is not a radix-<var>R</var> digit, then
 return failure. </p>
    <li>
     <p>Return the mathematical integer value that is represented by <var>input</var> in
 radix-<var>R</var> notation, using <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-hex-digit" id="ref-for-ascii-hex-digit①">ASCII hex digits</a> for digits with values 0
 through 15. </p>
   </ol>
   <hr>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="concept-ipv4-parser">IPv4 parser</dfn> takes a string <var>input</var> and then runs
these steps: </p>
   <ol>
    <li>
     <p>Let <var>validationErrorFlag</var> be unset. </p>
    <li>
     <p>Let <var>parts</var> be <var>input</var> split on U+002E (.). </p>
    <li>
     <p>If the last item in <var>parts</var> is the empty string, then: </p>
     <ol>
      <li>
       <p>Set <var>validationErrorFlag</var>. </p>
      <li>
       <p>If <var>parts</var> has more than one item, then remove the last item from <var>parts</var>. </p>
     </ol>
    <li>
     <p>If <var>parts</var> has more than four items, return <var>input</var>. </p>
    <li>
     <p>Let <var>numbers</var> be the empty list. </p>
    <li>
     <p>For each <var>part</var> in <var>parts</var>: </p>
     <ol>
      <li>
       <p>If <var>part</var> is the empty string, return <var>input</var>. </p>
       <p class="example no-backref" id="example-c2afe535"><a class="self-link" href="#example-c2afe535"></a><code>0..0x300</code> is a <a data-link-type="dfn" href="#concept-domain" id="ref-for-concept-domain⑤">domain</a>, not an <a data-link-type="dfn" href="#concept-ipv4" id="ref-for-concept-ipv4②">IPv4 address</a>. </p>
      <li>
       <p>Let <var>n</var> be the result of <a data-link-type="dfn" href="#ipv4-number-parser" id="ref-for-ipv4-number-parser">parsing</a> <var>part</var> using <var>validationErrorFlag</var>. </p>
      <li>
       <p>If <var>n</var> is failure, return <var>input</var>. </p>
      <li>
       <p>Append <var>n</var> to <var>numbers</var>. </p>
     </ol>
    <li>
     <p>If <var>validationErrorFlag</var> is set, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑧">validation error</a>. </p>
    <li>
     <p>If any item in <var>numbers</var> is greater than 255, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑨">validation error</a>. </p>
    <li>
     <p>If any but the last item in <var>numbers</var> is greater than 255, return
 failure. </p>
    <li>
     <p>If the last item in <var>numbers</var> is greater than or equal to
 256<sup>(5 − the number of items in <var>numbers</var>)</sup>, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error①⓪">validation error</a>,
 return failure. </p>
    <li>
     <p>Let <var>ipv4</var> be the last item in <var>numbers</var>. </p>
    <li>
     <p>Remove the last item from <var>numbers</var>. </p>
    <li>
     <p>Let <var>counter</var> be zero. </p>
    <li>
     <p>For each <var>n</var> in <var>numbers</var>: </p>
     <ol>
      <li>
       <p>Increment <var>ipv4</var> by <var>n</var> ×
   256<sup>(3 − <var>counter</var>)</sup>. </p>
      <li>
       <p>Increment <var>counter</var> by 1. </p>
     </ol>
    <li>
     <p>Return <var>ipv4</var>. </p>
   </ol>
   <hr>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="concept-ipv6-parser">IPv6 parser</dfn> takes a string <var>input</var> and
then runs these steps: </p>
   <ol>
    <li>
     <p>Let <var>address</var> be a new <a data-link-type="dfn" href="#concept-ipv6" id="ref-for-concept-ipv6①">IPv6 address</a> whose <a data-link-type="dfn" href="#concept-ipv6-piece" id="ref-for-concept-ipv6-piece">IPv6 pieces</a> are all 0. </p>
    <li>
     <p>Let <var>pieceIndex</var> be 0. </p>
    <li>
     <p>Let <var>compress</var> be null. </p>
    <li>
     <p>Let <var>pointer</var> be a pointer into <var>input</var>, initially 0 (pointing to the
 first code point). </p>
    <li>
     <p>If <a data-link-type="dfn" href="#c" id="ref-for-c①">c</a> is U+003A (:), then: </p>
     <ol>
      <li>
       <p>If <a data-link-type="dfn" href="#remaining" id="ref-for-remaining①">remaining</a> does not start with U+003A (:), <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error①①">validation error</a>, return
   failure. </p>
      <li>
       <p>Increase <var>pointer</var> by 2. </p>
      <li>
       <p>Increase <var>pieceIndex</var> by 1 and then set <var>compress</var> to <var>pieceIndex</var>. </p>
     </ol>
    <li>
     <p>While <a data-link-type="dfn" href="#c" id="ref-for-c②">c</a> is not the <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point">EOF code point</a>: </p>
     <ol>
      <li>
       <p>If <var>pieceIndex</var> is 8, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error①②">validation error</a>, return failure. </p>
      <li>
       <p>If <a data-link-type="dfn" href="#c" id="ref-for-c③">c</a> is U+003A (:), then: </p>
       <ol>
        <li>
         <p>If <var>compress</var> is non-null, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error①③">validation error</a>, return failure. </p>
        <li>Increase <var>pointer</var> and <var>pieceIndex</var> by 1, set <var>compress</var> to <var>pieceIndex</var>, and then <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#iteration-continue" id="ref-for-iteration-continue">continue</a>. 
       </ol>
      <li>
       <p>Let <var>value</var> and <var>length</var> be 0. </p>
      <li>
       <p>While <var>length</var> is less than 4 and <a data-link-type="dfn" href="#c" id="ref-for-c④">c</a> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-hex-digit" id="ref-for-ascii-hex-digit②">ASCII hex digit</a>, set <var>value</var> to <var>value</var> × 0x10 + <a data-link-type="dfn" href="#c" id="ref-for-c⑤">c</a> interpreted as hexadecimal number,
   and increase <var>pointer</var> and <var>length</var> by 1. </p>
      <li>
       <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑥">c</a> is U+002E (.), then: </p>
       <ol>
        <li>
         <p>If <var>length</var> is 0, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error①④">validation error</a>, return failure. </p>
        <li>
         <p>Decrease <var>pointer</var> by <var>length</var>. </p>
        <li>
         <p>If <var>pieceIndex</var> is greater than 6, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error①⑤">validation error</a>, return failure. </p>
        <li>
         <p>Let <var>numbersSeen</var> be 0. </p>
        <li>
         <p>While <a data-link-type="dfn" href="#c" id="ref-for-c⑦">c</a> is not the <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point①">EOF code point</a>: </p>
         <ol>
          <li>
           <p>Let <var>ipv4Piece</var> be null. </p>
          <li>
           <p>If <var>numbersSeen</var> is greater than 0, then: </p>
           <ol>
            <li>
             <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑧">c</a> is a U+002E (.) and <var>numbersSeen</var> is less than 4, then increase <var>pointer</var> by 1. </p>
            <li>Otherwise, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error①⑥">validation error</a>, return failure. 
           </ol>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑨">c</a> is not an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-digit" id="ref-for-ascii-digit①">ASCII digit</a>, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error①⑦">validation error</a>, return failure. </p>
          <li>
           <p>While <a data-link-type="dfn" href="#c" id="ref-for-c①⓪">c</a> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-digit" id="ref-for-ascii-digit②">ASCII digit</a>: </p>
           <ol>
            <li>
             <p>Let <var>number</var> be <a data-link-type="dfn" href="#c" id="ref-for-c①①">c</a> interpreted as decimal number. </p>
            <li>
             <p>If <var>ipv4Piece</var> is null, then set <var>ipv4Piece</var> to <var>number</var>. </p>
             <p>Otherwise, if <var>ipv4Piece</var> is 0, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error①⑧">validation error</a>, return failure. </p>
             <p>Otherwise, set <var>ipv4Piece</var> to <var>ipv4Piece</var> × 10 + <var>number</var>. </p>
            <li>
             <p>If <var>ipv4Piece</var> is greater than 255, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error①⑨">validation error</a>, return
         failure. </p>
            <li>
             <p>Increase <var>pointer</var> by 1. </p>
           </ol>
          <li>
           <p>Set <var>address</var>[<var>pieceIndex</var>] to <var>address</var>[<var>pieceIndex</var>] × 0x100 + <var>ipv4Piece</var>. </p>
          <li>
           <p>Increase <var>numbersSeen</var> by 1. </p>
          <li>
           <p>If <var>numbersSeen</var> is 2 or 4, then increase <var>pieceIndex</var> by 1. </p>
         </ol>
        <li>
         <p>If <var>numbersSeen</var> is not 4, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error②⓪">validation error</a>, return failure. </p>
        <li>
         <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#iteration-break" id="ref-for-iteration-break">Break</a>. </p>
       </ol>
      <li>
       <p>Otherwise, if <a data-link-type="dfn" href="#c" id="ref-for-c①②">c</a> is U+003A (:): </p>
       <ol>
        <li>
         <p>Increase <var>pointer</var> by 1. </p>
        <li>
         <p>If <a data-link-type="dfn" href="#c" id="ref-for-c①③">c</a> is the <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point②">EOF code point</a>, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error②①">validation error</a>, return failure. </p>
       </ol>
      <li>
       <p>Otherwise, if <a data-link-type="dfn" href="#c" id="ref-for-c①④">c</a> is not the <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point③">EOF code point</a>, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error②②">validation error</a>, return
   failure. </p>
      <li>
       <p>Set <var>address</var>[<var>pieceIndex</var>] to <var>value</var>. </p>
      <li>
       <p>Increase <var>pieceIndex</var> by 1. </p>
     </ol>
    <li>
     <p>If <var>compress</var> is non-null, then: </p>
     <ol>
      <li>
       <p>Let <var>swaps</var> be <var>pieceIndex</var> − <var>compress</var>. </p>
      <li>
       <p>Set <var>pieceIndex</var> to 7. </p>
      <li>
       <p>While <var>pieceIndex</var> is not 0 and <var>swaps</var> is greater than 0, swap <var>address</var>[<var>pieceIndex</var>] with <var>address</var>[<var>compress</var> + <var>swaps</var> − 1], and then decrease both <var>pieceIndex</var> and <var>swaps</var> by 1. </p>
     </ol>
    <li>
     <p>Otherwise, if <var>compress</var> is null and <var>pieceIndex</var> is not 8, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error②③">validation error</a>, return failure. </p>
    <li>
     <p>Return <var>address</var>. </p>
   </ol>
   <hr>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="concept-opaque-host-parser">opaque-host parser</dfn> takes a string <var>input</var>, and then runs these steps: </p>
   <ol>
    <li>
     <p>If <var>input</var> contains a <a data-link-type="dfn" href="#forbidden-host-code-point" id="ref-for-forbidden-host-code-point①">forbidden host code point</a> excluding U+0025 (%), <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error②④">validation error</a>, return failure. </p>
    <li>
     <p>Let <var>output</var> be the empty string. </p>
    <li>
     <p>For each code point in <var>input</var>, <a data-link-type="dfn" href="#utf-8-percent-encode" id="ref-for-utf-8-percent-encode">UTF-8 percent encode</a> it using the <a data-link-type="dfn" href="#c0-control-percent-encode-set" id="ref-for-c0-control-percent-encode-set①">C0 control percent-encode set</a>, and append the result to <var>output</var>. </p>
    <li>
     <p>Return <var>output</var>. </p>
   </ol>
   <h3 class="heading settled" data-level="3.6" id="host-serializing"><span class="secno">3.6. </span><span class="content">Host serializing</span><a class="self-link" href="#host-serializing"></a></h3>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="concept-host-serializer">host serializer</dfn> takes a <a data-link-type="dfn" href="#concept-host" id="ref-for-concept-host①①">host</a> <var>host</var> and then runs these steps: </p>
   <ol>
    <li>
     <p>If <var>host</var> is an <a data-link-type="dfn" href="#concept-ipv4" id="ref-for-concept-ipv4③">IPv4 address</a>, return the result of
 running the <a data-link-type="dfn" href="#concept-ipv4-serializer" id="ref-for-concept-ipv4-serializer">IPv4 serializer</a> on <var>host</var>. </p>
    <li>
     <p>Otherwise, if <var>host</var> is an <a data-link-type="dfn" href="#concept-ipv6" id="ref-for-concept-ipv6②">IPv6 address</a>, return U+005B ([), followed by the
 result of running the <a data-link-type="dfn" href="#concept-ipv6-serializer" id="ref-for-concept-ipv6-serializer">IPv6 serializer</a> on <var>host</var>, followed by U+005D (]). </p>
    <li>
     <p>Otherwise, <var>host</var> is a <a data-link-type="dfn" href="#concept-domain" id="ref-for-concept-domain⑥">domain</a>, <a data-link-type="dfn" href="#opaque-host" id="ref-for-opaque-host①">opaque host</a>, or <a data-link-type="dfn" href="#empty-host" id="ref-for-empty-host①">empty host</a>,
 return <var>host</var>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="concept-ipv4-serializer">IPv4 serializer</dfn> takes an <a data-link-type="dfn" href="#concept-ipv4" id="ref-for-concept-ipv4④">IPv4 address</a> <var>address</var> and then runs these steps:</p>
   <ol>
    <li>
     <p>Let <var>output</var> be the empty string. </p>
    <li>
     <p>Let <var>n</var> be the value of <var>address</var>. </p>
    <li>
     <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate">For each</a> <var>i</var> in the range 1 to 4, inclusive: </p>
     <ol>
      <li>
       <p>Prepend <var>n</var> % 256, <a data-link-type="dfn" href="#serialize-an-integer" id="ref-for-serialize-an-integer">serialized</a>, to <var>output</var>. </p>
      <li>
       <p>If <var>i</var> is not 4, then prepend U+002E (.) to <var>output</var>. </p>
      <li>
       <p>Set <var>n</var> to floor(<var>n</var> / 256). </p>
     </ol>
    <li>
     <p>Return <var>output</var>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="concept-ipv6-serializer">IPv6 serializer</dfn> takes an <a data-link-type="dfn" href="#concept-ipv6" id="ref-for-concept-ipv6③">IPv6 address</a> <var>address</var> and then runs these steps: </p>
   <ol>
    <li>
     <p>Let <var>output</var> be the empty string. </p>
    <li>
     <p>Let <var>compress</var> be an index to the first <a data-link-type="dfn" href="#concept-ipv6-piece" id="ref-for-concept-ipv6-piece①">IPv6 piece</a> in the first longest
  sequences of <var>address</var>’s <a data-link-type="dfn" href="#concept-ipv6-piece" id="ref-for-concept-ipv6-piece②">IPv6 pieces</a> that are 0. </p>
     <p class="example" id="example-e2b3492e"><a class="self-link" href="#example-e2b3492e"></a>In <code>0:f:0:0:f:f:0:0</code> it would point to
  the second 0. </p>
    <li>
     <p>If there is no sequence of <var>address</var>’s <a data-link-type="dfn" href="#concept-ipv6-piece" id="ref-for-concept-ipv6-piece③">IPv6 pieces</a> that are 0 that is
 longer than 1, then set <var>compress</var> to null. </p>
    <li>
     <p>Let <var>ignore0</var> be false. </p>
    <li>
     <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate①">For each</a> <var>pieceIndex</var> in the range 0 to 7, inclusive: </p>
     <ol>
      <li>
       <p>If <var>ignore0</var> is true and <var>address</var>[<var>pieceIndex</var>] is 0, then <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#iteration-continue" id="ref-for-iteration-continue①">continue</a>. </p>
      <li>
       <p>Otherwise, if <var>ignore0</var> is true, set <var>ignore0</var> to false. </p>
      <li>
       <p>If <var>compress</var> is <var>pieceIndex</var>, then: </p>
       <ol>
        <li>
         <p>Let <var>separator</var> be "<code>::</code>" if <var>pieceIndex</var> is 0, and
     U+003A (:) otherwise. </p>
        <li>
         <p>Append <var>separator</var> to <var>output</var>. </p>
        <li>
         <p>Set <var>ignore0</var> to true and <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#iteration-continue" id="ref-for-iteration-continue②">continue</a>. </p>
       </ol>
      <li>
       <p>Append <var>address</var>[<var>pieceIndex</var>], represented as the shortest possible
   lowercase hexadecimal number, to <var>output</var>. </p>
      <li>
       <p>If <var>pieceIndex</var> is not 7, then append U+003A (:) to <var>output</var>. </p>
     </ol>
    <li>
     <p>Return <var>output</var>. </p>
   </ol>
   <p class="note" role="note">This algorithm requires the recommendation from
A Recommendation for IPv6 Address Text Representation. <a data-link-type="biblio" href="#biblio-rfc5952">[RFC5952]</a> </p>
   <h3 class="heading settled" data-level="3.7" id="host-equivalence"><span class="secno">3.7. </span><span class="content">Host equivalence</span><a class="self-link" href="#host-equivalence"></a></h3>
   <p>To determine whether a <a data-link-type="dfn" href="#concept-host" id="ref-for-concept-host①②">host</a> <var>A</var> <dfn class="dfn-paneled" data-dfn-for="host" data-dfn-type="dfn" data-export data-lt="equal" id="concept-host-equals">equals</dfn> <var>B</var>, return true if <var>A</var> is <var>B</var>, and false otherwise.</p>
   <p class="XXX">Certificate comparison requires a host equivalence check that ignores the
trailing dot of a domain (if any). However, those hosts have also various other facets
enforced, such as DNS length, that are not enforced here, as URLs do not enforce them. If
anyone has a good suggestion for how to bring these two closer together, or what a good
unified model would be, please file an issue. </p>
   <h2 class="heading settled" data-level="4" id="urls"><span class="secno">4. </span><span class="content">URLs</span><a class="self-link" href="#urls"></a></h2>
   <p>At a high level, a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑦">URL</a>, <a data-link-type="dfn" href="#valid-url-string" id="ref-for-valid-url-string">valid URL string</a>, <a data-link-type="dfn" href="#concept-url-parser" id="ref-for-concept-url-parser">URL parser</a>, and <a data-link-type="dfn" href="#concept-url-serializer" id="ref-for-concept-url-serializer">URL serializer</a> relate as follows: </p>
   <ul>
    <li>
     <p>The <a data-link-type="dfn" href="#concept-url-parser" id="ref-for-concept-url-parser①">URL parser</a> takes an arbitrary string and returns either failure or a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑧">URL</a>. </p>
    <li>
     <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑨">URL</a> can be seen as the in-memory representation. </p>
    <li>
     <p>A <a data-link-type="dfn" href="#valid-url-string" id="ref-for-valid-url-string①">valid URL string</a> defines what input would not trigger a <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error②⑤">validation error</a> or
 failure when given to the <a data-link-type="dfn" href="#concept-url-parser" id="ref-for-concept-url-parser②">URL parser</a>. I.e., input that would be considered conforming or
 valid. </p>
    <li>
     <p>The <a data-link-type="dfn" href="#concept-url-serializer" id="ref-for-concept-url-serializer①">URL serializer</a> takes a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url①⓪">URL</a> and returns an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-string" id="ref-for-ascii-string②">ASCII string</a>. (If
 that string is then <a data-link-type="dfn" href="#concept-url-parser" id="ref-for-concept-url-parser③">parsed</a>, the result will <a data-link-type="dfn" href="#concept-url-equals" id="ref-for-concept-url-equals">equal</a> the <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url①①">URL</a> that was <a data-link-type="dfn" href="#concept-url-serializer" id="ref-for-concept-url-serializer②">serialized</a>.) </p>
   </ul>
   <div class="example" id="example-url-parsing">
    <a class="self-link" href="#example-url-parsing"></a> 
    <table>
     <tbody>
      <tr>
       <th>Input 
       <th>Base 
       <th>Valid 
       <th>Output 
      <tr>
       <td><code>https:example.org</code> 
       <td>
       <td>❌ 
       <td><code>https://example.org/</code> 
      <tr>
       <td><code>https://////example.com///</code> 
       <td>
       <td>❌ 
       <td><code>https://example.com///</code> 
      <tr>
       <td><code>https://example.com/././foo</code> 
       <td>
       <td>✅ 
       <td><code>https://example.com/foo</code> 
      <tr>
       <td><code>hello:world</code> 
       <td><code>https://example.com/</code> 
       <td>✅ 
       <td><code>hello:world</code> 
      <tr>
       <td><code>https:example.org</code> 
       <td><code>https://example.com/</code> 
       <td>❌ 
       <td><code>https://example.com/example.org</code> 
      <tr>
       <td><code>\example\..\demo/.\</code> 
       <td><code>https://example.com/</code> 
       <td>❌ 
       <td><code>https://example.com/demo/</code> 
      <tr>
       <td><code>example</code> 
       <td><code>https://example.com/demo</code> 
       <td>✅ 
       <td><code>https://example.com/example</code> 
      <tr>
       <td><code>file:///C|/demo</code> 
       <td>
       <td>❌ 
       <td><code>file:///C:/demo</code> 
      <tr>
       <td><code>..</code> 
       <td><code>file:///C:/demo</code> 
       <td>✅ 
       <td><code>file:///C:/</code> 
      <tr>
       <td><code>file://loc%61lhost/</code> 
       <td>
       <td>✅ 
       <td><code>file:///</code> 
      <tr>
       <td><code>https://user:password@example.org/</code> 
       <td>
       <td>❌ 
       <td><code>https://user:password@example.org/</code> 
      <tr>
       <td><code>https://example.org/foo bar</code> 
       <td>
       <td>❌ 
       <td><code>https://example.org/foo%20bar</code> 
      <tr>
       <td><code>https://EXAMPLE.com/../x</code> 
       <td>
       <td>✅ 
       <td><code>https://example.com/x</code> 
      <tr>
       <td><code>https://ex ample.org/</code> 
       <td>
       <td>❌ 
       <td>Failure 
      <tr>
       <td><code>example</code> 
       <td>
       <td>❌, due to lack of base 
       <td>Failure 
      <tr>
       <td><code>https://example.com:demo</code> 
       <td>
       <td>❌ 
       <td>Failure 
      <tr>
       <td><code>http://[www.example.com]/</code> 
       <td>
       <td>❌ 
       <td>Failure 
    </table>
    <p>The base and output <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url①②">URL</a> are represented in <a data-link-type="dfn" href="#concept-url-serializer" id="ref-for-concept-url-serializer③">serialized</a> form for brevity. </p>
   </div>
   <h3 class="heading settled" data-level="4.1" id="url-representation"><span class="secno">4.1. </span><span class="content">URL representation</span><a class="self-link" href="#url-representation"></a></h3>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="URL|URL record" id="concept-url">URL</dfn> is a universal identifier. To
disambiguate from a <a data-link-type="dfn" href="#valid-url-string" id="ref-for-valid-url-string②">valid URL string</a> it can also be referred to as a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url①③">URL record</a>. </p>
   <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url①④">URL</a>’s <dfn class="dfn-paneled" data-dfn-for="url" data-dfn-type="dfn" data-export id="concept-url-scheme">scheme</dfn> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-string" id="ref-for-ascii-string③">ASCII string</a> that identifies the type of <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url①⑤">URL</a> and can be used to
dispatch a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url①⑥">URL</a> for further processing after <a data-link-type="dfn" href="#concept-url-parser" id="ref-for-concept-url-parser④">parsing</a>.
It is initially the empty string. </p>
   <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url①⑦">URL</a>’s <dfn class="dfn-paneled" data-dfn-for="url" data-dfn-type="dfn" data-export id="concept-url-username">username</dfn> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-string" id="ref-for-ascii-string④">ASCII string</a> identifying a username. It is initially the empty string. </p>
   <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url①⑧">URL</a>’s <dfn class="dfn-paneled" data-dfn-for="url" data-dfn-type="dfn" data-export id="concept-url-password">password</dfn> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-string" id="ref-for-ascii-string⑤">ASCII string</a> identifying a password. It is initially the empty string. </p>
   <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url①⑨">URL</a>’s <dfn class="dfn-paneled" data-dfn-for="url" data-dfn-type="dfn" data-export id="concept-url-host">host</dfn> is null or a <a data-link-type="dfn" href="#concept-host" id="ref-for-concept-host①③">host</a>. It is initially null. </p>
   <div class="note" role="note">
    <p>The following table lists allowed <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url②⓪">URL</a>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme">scheme</a> / <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host">host</a> combinations. </p>
    <table>
     <tbody>
      <tr>
       <th rowspan="2"><a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme①">scheme</a> 
       <th colspan="6"><a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host①">host</a> 
      <tr>
       <th><a data-link-type="dfn" href="#concept-domain" id="ref-for-concept-domain⑦">domain</a> 
       <th><a data-link-type="dfn" href="#concept-ipv4" id="ref-for-concept-ipv4⑤">IPv4 address</a> 
       <th><a data-link-type="dfn" href="#concept-ipv6" id="ref-for-concept-ipv6④">IPv6 address</a> 
       <th><a data-link-type="dfn" href="#opaque-host" id="ref-for-opaque-host②">opaque host</a> 
       <th><a data-link-type="dfn" href="#empty-host" id="ref-for-empty-host②">empty host</a> 
       <th>null 
      <tr>
       <td>non-"<code>file</code>" <a data-link-type="dfn" href="#special-scheme" id="ref-for-special-scheme">special</a> 
       <td>✅ 
       <td>✅ 
       <td>✅ 
       <td>❌ 
       <td>❌ 
       <td>❌ 
      <tr>
       <td>"<code>file</code>" 
       <td>✅ 
       <td>✅ 
       <td>✅ 
       <td>❌ 
       <td>✅ 
       <td>✅ 
      <tr>
       <td><a data-link-type="dfn" href="#special-scheme" id="ref-for-special-scheme①">non-special</a> 
       <td>❌ 
       <td>❌ 
       <td>✅ 
       <td>✅ 
       <td>✅ 
       <td>✅ 
    </table>
   </div>
   <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url②①">URL</a>’s <dfn class="dfn-paneled" data-dfn-for="url" data-dfn-type="dfn" data-export id="concept-url-port">port</dfn> is either
null or a 16-bit unsigned integer that identifies a networking port. It is initially null. </p>
   <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url②②">URL</a>’s <dfn class="dfn-paneled" data-dfn-for="url" data-dfn-type="dfn" data-export id="concept-url-path">path</dfn> is a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list①">list</a> of
zero or more <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-string" id="ref-for-ascii-string⑥">ASCII strings</a> holding data, usually identifying a location in hierarchical form.
It is initially empty. </p>
   <p class="note no-backref" role="note">A <a data-link-type="dfn" href="#is-special" id="ref-for-is-special">special</a> <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url②③">URL</a> always has a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty">non-empty</a> <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path">path</a>. </p>
   <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url②④">URL</a>’s <dfn class="dfn-paneled" data-dfn-for="url" data-dfn-type="dfn" data-export id="concept-url-query">query</dfn> is either
null or an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-string" id="ref-for-ascii-string⑦">ASCII string</a> holding data. It is initially null. </p>
   <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url②⑤">URL</a>’s <dfn class="dfn-paneled" data-dfn-for="url" data-dfn-type="dfn" data-export id="concept-url-fragment">fragment</dfn> is
either null or an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-string" id="ref-for-ascii-string⑧">ASCII string</a> holding data that can be used for further processing on the
resource the <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url②⑥">URL</a>’s other components identify. It is initially null. </p>
   <p id="non-relative-flag">A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url②⑦">URL</a> also has an associated <dfn class="dfn-paneled" data-dfn-for="url" data-dfn-type="dfn" data-export id="url-cannot-be-a-base-url-flag">cannot-be-a-base-URL flag</dfn>. It is initially unset. </p>
   <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url②⑧">URL</a> also has an associated <dfn class="dfn-paneled" data-dfn-for="url" data-dfn-type="dfn" data-export id="concept-url-blob-entry">blob URL entry</dfn> that is either null or a <a data-link-type="dfn" href="https://w3c.github.io/FileAPI/#blob-url-entry" id="ref-for-blob-url-entry">blob URL entry</a>. It is initially null. </p>
   <p class="note no-backref" role="note">This is used to support caching the object a "<code>blob</code>" URL
refers to as well as its origin. It is important that these are cached as the <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url②⑨">URL</a> might
be removed from the <a data-link-type="dfn" href="https://w3c.github.io/FileAPI/#BlobURLStore" id="ref-for-BlobURLStore">blob URL store</a> between parsing and fetching, while fetching will still
need to succeed. </p>
   <h3 class="heading settled" data-level="4.2" id="url-miscellaneous"><span class="secno">4.2. </span><span class="content">URL miscellaneous</span><a class="self-link" href="#url-miscellaneous"></a></h3>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="special-scheme">special scheme</dfn> is a <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme②">scheme</a> listed in the first column of
the following table. A <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="default-port">default port</dfn> is a <a data-link-type="dfn" href="#special-scheme" id="ref-for-special-scheme②">special scheme</a>’s optional
corresponding <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port">port</a> and is listed in the second column on the same row. </p>
   <table>
    <tbody>
     <tr>
      <th><a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme③">scheme</a> 
      <th><a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port①">port</a> 
     <tr>
      <td>"<code>ftp</code>"
      <td>21 
     <tr>
      <td>"<code>file</code>"
      <td>
     <tr>
      <td>"<code>http</code>"
      <td>80 
     <tr>
      <td>"<code>https</code>"
      <td>443 
     <tr>
      <td>"<code>ws</code>"
      <td>80 
     <tr>
      <td>"<code>wss</code>"
      <td>443 
   </table>
   <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url③⓪">URL</a> <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="is-special">is special</dfn> if its <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme④">scheme</a> is a <a data-link-type="dfn" href="#special-scheme" id="ref-for-special-scheme③">special scheme</a>. A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url③①">URL</a> <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="is-not-special">is not special</dfn> if its <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme⑤">scheme</a> is
not a <a data-link-type="dfn" href="#special-scheme" id="ref-for-special-scheme④">special scheme</a>. </p>
   <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url③②">URL</a> <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="include credentials|includes credentials" id="include-credentials">includes credentials</dfn> if its <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username">username</a> or <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password">password</a> is not the empty string. </p>
   <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url③③">URL</a> <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="cannot-have-a-username-password-port">cannot have a username/password/port</dfn> if its <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host②">host</a> is null or the empty string, its <a data-link-type="dfn" href="#url-cannot-be-a-base-url-flag" id="ref-for-url-cannot-be-a-base-url-flag">cannot-be-a-base-URL flag</a> is
set, or its <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme⑥">scheme</a> is "<code>file</code>". </p>
   <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url③④">URL</a> can be designated as <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="concept-base-url">base URL</dfn>. </p>
   <p class="note no-backref" role="note">A <a data-link-type="dfn" href="#concept-base-url" id="ref-for-concept-base-url">base URL</a> is useful for the <a data-link-type="dfn" href="#concept-url-parser" id="ref-for-concept-url-parser⑤">URL parser</a> when the
input might be a <a data-link-type="dfn" href="#relative-url-string" id="ref-for-relative-url-string">relative-URL string</a>. </p>
   <hr>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="windows-drive-letter">Windows drive letter</dfn> is two code points, of which the first is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-alpha" id="ref-for-ascii-alpha">ASCII alpha</a> and the second is either U+003A (:) or U+007C (|). </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="normalized-windows-drive-letter">normalized Windows drive letter</dfn> is a <a data-link-type="dfn" href="#windows-drive-letter" id="ref-for-windows-drive-letter">Windows drive letter</a> of which the second
code point is U+003A (:). </p>
   <p class="note" role="note">As per the <a href="#url-writing">URL writing</a> section, only a <a data-link-type="dfn" href="#normalized-windows-drive-letter" id="ref-for-normalized-windows-drive-letter">normalized Windows drive letter</a> is conforming. </p>
   <p>A string <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="start with a Windows drive letter|starts with a Windows drive letter" data-noexport id="start-with-a-windows-drive-letter">starts with a Windows drive letter</dfn> if all of the following are true: </p>
   <ul class="brief">
    <li>its <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string-length" id="ref-for-string-length">length</a> is greater than or equal to 2 
    <li>its first two code points are a <a data-link-type="dfn" href="#windows-drive-letter" id="ref-for-windows-drive-letter①">Windows drive letter</a> 
    <li>its <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#string-length" id="ref-for-string-length①">length</a> is 2 or its third code point is U+002F (/), U+005C (\),
 U+003F (?), or U+0023 (#). 
   </ul>
   <div class="example" id="example-start-with-a-widows-drive-letter">
    <a class="self-link" href="#example-start-with-a-widows-drive-letter"></a> 
    <table>
     <tbody>
      <tr>
       <th>String 
       <th>Starts with a Windows drive letter 
      <tr>
       <td>"<code>c:</code>" 
       <td>✅ 
      <tr>
       <td>"<code>c:/</code>" 
       <td>✅ 
      <tr>
       <td>"<code>c:a</code>" 
       <td>❌ 
    </table>
   </div>
   <p id="pop-a-urls-path">To <dfn class="dfn-paneled" data-dfn-type="dfn" data-local-lt="shorten" data-noexport id="shorten-a-urls-path">shorten a <var>url</var>’s path</dfn>: </p>
   <ol>
    <li>
     <p>Let <var>path</var> be <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path①">path</a>. </p>
    <li>
     <p>If <var>path</var> <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty①">is empty</a>, then return. </p>
    <li>
     <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme⑦">scheme</a> is "<code>file</code>", <var>path</var>’s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-size" id="ref-for-list-size">size</a> is 1, and <var>path</var>[0] is a <a data-link-type="dfn" href="#normalized-windows-drive-letter" id="ref-for-normalized-windows-drive-letter①">normalized Windows drive letter</a>, then
 return. </p>
    <li>
     <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-remove" id="ref-for-list-remove">Remove</a> <var>path</var>’s last item. </p>
   </ol>
   <h3 class="heading settled" data-level="4.3" id="url-writing"><span class="secno">4.3. </span><span class="content">URL writing</span><span id="url-syntax"></span><a class="self-link" href="#url-writing"></a></h3>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="valid-url-string">valid URL string<span id="syntax-url"></span></dfn> must be either a <a data-link-type="dfn" href="#relative-url-with-fragment-string" id="ref-for-relative-url-with-fragment-string">relative-URL-with-fragment string</a> or an <a data-link-type="dfn" href="#absolute-url-with-fragment-string" id="ref-for-absolute-url-with-fragment-string">absolute-URL-with-fragment string</a>. </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="absolute-url-with-fragment-string">absolute-URL-with-fragment string<span id="syntax-url-absolute-with-fragment"></span></dfn> must be
an <a data-link-type="dfn" href="#absolute-url-string" id="ref-for-absolute-url-string">absolute-URL string</a>, optionally followed by U+0023 (#) and a <a data-link-type="dfn" href="#url-fragment-string" id="ref-for-url-fragment-string">URL-fragment string</a>. </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="absolute-url-string">absolute-URL string<span id="syntax-url-absolute"></span></dfn> must be one of the following </p>
   <ul class="brief">
    <li>
     <p>a <a data-link-type="dfn" href="#url-scheme-string" id="ref-for-url-scheme-string">URL-scheme string</a> that is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive">ASCII case-insensitive</a> match for a <a data-link-type="dfn" href="#special-scheme" id="ref-for-special-scheme⑤">special scheme</a> and not an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive①">ASCII case-insensitive</a> match for "<code>file</code>",
 followed by U+003A (:) and a <a data-link-type="dfn" href="#scheme-relative-special-url-string" id="ref-for-scheme-relative-special-url-string">scheme-relative-special-URL string</a> </p>
    <li>
     <p>a <a data-link-type="dfn" href="#url-scheme-string" id="ref-for-url-scheme-string①">URL-scheme string</a> that is <em>not</em> an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive②">ASCII case-insensitive</a> match for a <a data-link-type="dfn" href="#special-scheme" id="ref-for-special-scheme⑥">special scheme</a>, followed by U+003A (:) and a <a data-link-type="dfn" href="#relative-url-string" id="ref-for-relative-url-string①">relative-URL string</a> </p>
    <li>
     <p>a <a data-link-type="dfn" href="#url-scheme-string" id="ref-for-url-scheme-string②">URL-scheme string</a> that is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive③">ASCII case-insensitive</a> match for
 "<code>file</code>", followed by U+003A (:) and a <a data-link-type="dfn" href="#scheme-relative-file-url-string" id="ref-for-scheme-relative-file-url-string">scheme-relative-file-URL string</a> </p>
   </ul>
   <p>any optionally followed by U+003F (?) and a <a data-link-type="dfn" href="#url-query-string" id="ref-for-url-query-string">URL-query string</a>. </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="url-scheme-string">URL-scheme string<span id="syntax-url-scheme"></span></dfn> must be one <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-alpha" id="ref-for-ascii-alpha①">ASCII alpha</a>,
followed by zero or more of <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-alphanumeric" id="ref-for-ascii-alphanumeric">ASCII alphanumeric</a>, U+002B (+), U+002D (-), and U+002E (.). <a data-link-type="dfn" href="#url-scheme-string" id="ref-for-url-scheme-string③">Schemes</a> should be registered in the <cite>IANA URI [sic] Schemes</cite> registry. <a data-link-type="biblio" href="#biblio-iana-uri-schemes">[IANA-URI-SCHEMES]</a> <a data-link-type="biblio" href="#biblio-rfc7595">[RFC7595]</a> </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="relative-url-with-fragment-string">relative-URL-with-fragment string<span id="syntax-url-relative-with-fragment"></span></dfn> must be a <a data-link-type="dfn" href="#relative-url-string" id="ref-for-relative-url-string②">relative-URL string</a>, optionally followed by U+0023 (#) and a <a data-link-type="dfn" href="#url-fragment-string" id="ref-for-url-fragment-string①">URL-fragment string</a>. </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="relative-url-string">relative-URL string<span id="syntax-url-relative"></span></dfn> must be one of the following,
switching on <a data-link-type="dfn" href="#concept-base-url" id="ref-for-concept-base-url①">base URL</a>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme⑧">scheme</a>: </p>
   <dl class="switch">
    <dt>A <a data-link-type="dfn" href="#special-scheme" id="ref-for-special-scheme⑦">special scheme</a> that is not "<code>file</code>" 
    <dd>
     <p>a <a data-link-type="dfn" href="#scheme-relative-special-url-string" id="ref-for-scheme-relative-special-url-string①">scheme-relative-special-URL string</a> </p>
    <dd>
     <p>a <a data-link-type="dfn" href="#path-absolute-url-string" id="ref-for-path-absolute-url-string">path-absolute-URL string</a> </p>
    <dd>
     <p>a <a data-link-type="dfn" href="#path-relative-scheme-less-url-string" id="ref-for-path-relative-scheme-less-url-string">path-relative-scheme-less-URL string</a> </p>
    <dt>"<code>file</code>" 
    <dd>
     <p>a <a data-link-type="dfn" href="#scheme-relative-file-url-string" id="ref-for-scheme-relative-file-url-string①">scheme-relative-file-URL string</a> </p>
    <dd>
     <p>a <a data-link-type="dfn" href="#path-absolute-url-string" id="ref-for-path-absolute-url-string①">path-absolute-URL string</a> if <a data-link-type="dfn" href="#concept-base-url" id="ref-for-concept-base-url②">base URL</a>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host③">host</a> is an <a data-link-type="dfn" href="#empty-host" id="ref-for-empty-host③">empty host</a> </p>
    <dd>
     <p>a <a data-link-type="dfn" href="#path-absolute-non-windows-file-url-string" id="ref-for-path-absolute-non-windows-file-url-string">path-absolute-non-Windows-file-URL string</a> if <a data-link-type="dfn" href="#concept-base-url" id="ref-for-concept-base-url③">base URL</a>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host④">host</a> is not an <a data-link-type="dfn" href="#empty-host" id="ref-for-empty-host④">empty host</a> </p>
    <dd>
     <p>a <a data-link-type="dfn" href="#path-relative-scheme-less-url-string" id="ref-for-path-relative-scheme-less-url-string①">path-relative-scheme-less-URL string</a> </p>
    <dt>Otherwise 
    <dd>
     <p>a <a data-link-type="dfn" href="#scheme-relative-url-string" id="ref-for-scheme-relative-url-string">scheme-relative-URL string</a> </p>
    <dd>
     <p>a <a data-link-type="dfn" href="#path-absolute-url-string" id="ref-for-path-absolute-url-string②">path-absolute-URL string</a> </p>
    <dd>
     <p>a <a data-link-type="dfn" href="#path-relative-scheme-less-url-string" id="ref-for-path-relative-scheme-less-url-string②">path-relative-scheme-less-URL string</a> </p>
   </dl>
   <p>any optionally followed by U+003F (?) and a <a data-link-type="dfn" href="#url-query-string" id="ref-for-url-query-string①">URL-query string</a>. </p>
   <p class="note no-backref" role="note">A non-null <a data-link-type="dfn" href="#concept-base-url" id="ref-for-concept-base-url④">base URL</a> is necessary when <a data-link-type="dfn" href="#concept-url-parser" id="ref-for-concept-url-parser⑥">parsing</a> a <a data-link-type="dfn" href="#relative-url-string" id="ref-for-relative-url-string③">relative-URL string</a>. </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="scheme-relative-special-url-string">scheme-relative-special-URL string</dfn> must be "<code>//</code>", followed by a <a data-link-type="dfn" href="#valid-host-string" id="ref-for-valid-host-string③">valid host string</a>, optionally followed by U+003A (:) and a <a data-link-type="dfn" href="#url-port-string" id="ref-for-url-port-string">URL-port string</a>, optionally
followed by a <a data-link-type="dfn" href="#path-absolute-url-string" id="ref-for-path-absolute-url-string③">path-absolute-URL string</a>. </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="url-port-string">URL-port string<span id="syntax-url-port"></span></dfn> must be zero or more <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-digit" id="ref-for-ascii-digit③">ASCII digits</a>. </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="scheme-relative-url-string">scheme-relative-URL string<span id="syntax-url-scheme-relative"></span></dfn> must be
"<code>//</code>", followed by an <a data-link-type="dfn" href="#opaque-host-and-port-string" id="ref-for-opaque-host-and-port-string">opaque-host-and-port string</a>, optionally followed by a <a data-link-type="dfn" href="#path-absolute-url-string" id="ref-for-path-absolute-url-string④">path-absolute-URL string</a>. </p>
   <p>An <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="opaque-host-and-port-string">opaque-host-and-port string</dfn> must be either the empty string or: a <a data-link-type="dfn" href="#valid-opaque-host-string" id="ref-for-valid-opaque-host-string">valid opaque-host string</a>, optionally followed by U+003A (:) and a <a data-link-type="dfn" href="#url-port-string" id="ref-for-url-port-string①">URL-port string</a>. </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="scheme-relative-file-url-string">scheme-relative-file-URL string<span id="syntax-url-file-scheme-relative"></span></dfn> must be
"<code>//</code>", followed by one of the following </p>
   <ul class="brief">
    <li>
     <p>a <a data-link-type="dfn" href="#valid-host-string" id="ref-for-valid-host-string④">valid host string</a>, optionally followed by a <a data-link-type="dfn" href="#path-absolute-non-windows-file-url-string" id="ref-for-path-absolute-non-windows-file-url-string①">path-absolute-non-Windows-file-URL string</a> </p>
    <li>
     <p>a <a data-link-type="dfn" href="#path-absolute-url-string" id="ref-for-path-absolute-url-string⑤">path-absolute-URL string</a>. </p>
   </ul>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="path-absolute-url-string">path-absolute-URL string<span id="syntax-url-path-absolute"></span></dfn> must be U+002F (/)
followed by a <a data-link-type="dfn" href="#path-relative-url-string" id="ref-for-path-relative-url-string">path-relative-URL string</a>. </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="path-absolute-non-windows-file-url-string">path-absolute-non-Windows-file-URL string<span id="syntax-url-file-path-absolute"></span></dfn> must be a <a data-link-type="dfn" href="#path-absolute-url-string" id="ref-for-path-absolute-url-string⑥">path-absolute-URL string</a> that does not start with: U+002F (/), followed by a <a data-link-type="dfn" href="#windows-drive-letter" id="ref-for-windows-drive-letter②">Windows drive letter</a>, followed by U+002F (/). </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="path-relative-url-string">path-relative-URL string<span id="syntax-url-path-relative"></span></dfn> must be zero or more <a data-link-type="dfn" href="#url-path-segment-string" id="ref-for-url-path-segment-string">URL-path-segment strings</a>, separated from each other by U+002F (/), and not start with
U+002F (/). </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="path-relative-scheme-less-url-string">path-relative-scheme-less-URL string<span id="syntax-url-path-relative-scheme-less"></span></dfn> must be a <a data-link-type="dfn" href="#path-relative-url-string" id="ref-for-path-relative-url-string①">path-relative-URL string</a> that does not start with: a <a data-link-type="dfn" href="#url-scheme-string" id="ref-for-url-scheme-string④">URL-scheme string</a>,
followed by U+003A (:). </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="url-path-segment-string">URL-path-segment string<span id="syntax-url-path-segment"></span></dfn> must be one of the
following </p>
   <ul class="brief">
    <li>
     <p>zero or more <a data-link-type="dfn" href="#url-units" id="ref-for-url-units①">URL units</a>, excluding U+002F (/) and U+003F (?), that together are not a <a data-link-type="dfn" href="#single-dot-path-segment" id="ref-for-single-dot-path-segment">single-dot path segment</a> or a <a data-link-type="dfn" href="#double-dot-path-segment" id="ref-for-double-dot-path-segment">double-dot path segment</a>. </p>
    <li>
     <p>a <a data-link-type="dfn" href="#single-dot-path-segment" id="ref-for-single-dot-path-segment①">single-dot path segment</a> </p>
    <li>
     <p>a <a data-link-type="dfn" href="#double-dot-path-segment" id="ref-for-double-dot-path-segment①">double-dot path segment</a>. </p>
   </ul>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="single-dot-path-segment">single-dot path segment<span id="syntax-url-path-segment-dot"></span></dfn> must be
"<code>.</code>" or an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive④">ASCII case-insensitive</a> match for "<code>%2e</code>". </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="double-dot-path-segment">double-dot path segment<span id="syntax-url-path-segment-dotdot"></span></dfn> must be
"<code>..</code>" or an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-case-insensitive" id="ref-for-ascii-case-insensitive⑤">ASCII case-insensitive</a> match for "<code>.%2e</code>",
"<code>%2e.</code>", or "<code>%2e%2e</code>". </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="url-query-string">URL-query string<span id="syntax-url-query"></span></dfn> must be zero or more <a data-link-type="dfn" href="#url-units" id="ref-for-url-units②">URL units</a>. </p>
   <p>A <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="url-fragment-string">URL-fragment string<span id="syntax-url-fragment"></span></dfn> must be zero or more <a data-link-type="dfn" href="#url-units" id="ref-for-url-units③">URL units</a>. </p>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="URL code point" id="url-code-points">URL code points</dfn> are <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-alphanumeric" id="ref-for-ascii-alphanumeric①">ASCII alphanumeric</a>,
U+0021 (!),
U+0024 ($),
U+0026 (&amp;),
U+0027 ('),
U+0028 LEFT PARENTHESIS,
U+0029 RIGHT PARENTHESIS,
U+002A (*),
U+002B (+),
U+002C (,),
U+002D (-),
U+002E (.),
U+002F (/),
U+003A (:),
U+003B (;),
U+003D (=),
U+003F (?),
U+0040 (@),
U+005F (_),
U+007E (~),
and <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#code-point" id="ref-for-code-point②">code points</a> in the range U+00A0 to U+10FFFD, inclusive, excluding <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#surrogate" id="ref-for-surrogate">surrogates</a> and <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#noncharacter" id="ref-for-noncharacter">noncharacters</a>. </p>
   <p class="note" role="note">Code points greater than U+007F DELETE will be converted to <a data-link-type="dfn" href="#percent-encoded-byte" id="ref-for-percent-encoded-byte②">percent-encoded bytes</a> by the <a data-link-type="dfn" href="#concept-url-parser" id="ref-for-concept-url-parser⑦">URL parser</a>. </p>
   <p class="note" role="note">In HTML, when the document encoding is a legacy encoding, code points in the <a data-link-type="dfn" href="#url-query-string" id="ref-for-url-query-string②">URL-query string</a> that are higher than U+007F DELETE will be converted to <a data-link-type="dfn" href="#percent-encoded-byte" id="ref-for-percent-encoded-byte③">percent-encoded bytes</a> <em>using the document’s encoding</em>. This
can cause problems if a URL that works in one document is copied to another document that uses a
different document encoding. Using the <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8" id="ref-for-utf-8">UTF-8</a> encoding everywhere solves this problem. </p>
   <div class="example" id="query-encoding-example">
    <a class="self-link" href="#query-encoding-example"></a> 
    <p>For example, consider this HTML document: </p>
<pre><code class="lang-html highlight"><c- cp>&lt;!doctype html></c->
<c- p>&lt;</c-><c- f>meta</c-> <c- e>charset</c-><c- o>=</c-><c- s>"windows-1252"</c-><c- p>></c->
<c- p>&lt;</c-><c- f>a</c-> <c- e>href</c-><c- o>=</c-><c- s>"?sm&amp;ouml;rg&amp;aring;sbord"</c-><c- p>></c->Test<c- p>&lt;/</c-><c- f>a</c-><c- p>></c-></code></pre>
    <p>Since the document encoding is windows-1252, the link’s <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url③⑤">URL</a>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query">query</a> will be "<code>sm%F6rg%E5sbord</code>". If the document encoding had been UTF-8, it would instead
 be "<code>sm%C3%B6rg%C3%A5sbord</code>". </p>
   </div>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="url-units">URL units</dfn> are <a data-link-type="dfn" href="#url-code-points" id="ref-for-url-code-points">URL code points</a> and <a data-link-type="dfn" href="#percent-encoded-byte" id="ref-for-percent-encoded-byte④">percent-encoded bytes</a>. </p>
   <p class="note" role="note"><a data-link-type="dfn" href="#percent-encoded-byte" id="ref-for-percent-encoded-byte⑤">Percent-encoded bytes</a> can be used to encode code points that are not <a data-link-type="dfn" href="#url-code-points" id="ref-for-url-code-points①">URL code points</a> or are excluded from being written. </p>
   <hr>
   <p class="note no-backref" role="note">There is no way to express a <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username①">username</a> or <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password①">password</a> of a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url③⑥">URL record</a> within a <a data-link-type="dfn" href="#valid-url-string" id="ref-for-valid-url-string③">valid URL string</a>. </p>
   <h3 class="heading settled" data-level="4.4" id="url-parsing"><span class="secno">4.4. </span><span class="content">URL parsing</span><a class="self-link" href="#url-parsing"></a></h3>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="concept-url-parser">URL parser</dfn> takes a string <var>input</var>, with an optional <a data-link-type="dfn" href="#concept-base-url" id="ref-for-concept-base-url⑤">base URL</a> <var>base</var> and an optional <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#encoding" id="ref-for-encoding">encoding</a> <var>encoding override</var>, and then runs these steps: </p>
   <p class="note no-backref" role="note">Non-web-browser implementations only need to implement the <a data-link-type="dfn" href="#concept-basic-url-parser" id="ref-for-concept-basic-url-parser">basic URL parser</a>. </p>
   <ol>
    <li>
     <p>Let <var>url</var> be the result of running the <a data-link-type="dfn" href="#concept-basic-url-parser" id="ref-for-concept-basic-url-parser①">basic URL parser</a> on <var>input</var> with <var>base</var>, and <var>encoding override</var> as provided. </p>
    <li>
     <p>If <var>url</var> is failure, return failure. </p>
    <li>
     <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme⑨">scheme</a> is not
 "<code>blob</code>", return <var>url</var>. </p>
    <li>
     <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-blob-entry" id="ref-for-concept-url-blob-entry">blob URL entry</a> to the result of <a data-link-type="dfn" href="https://w3c.github.io/FileAPI/#blob-url-resolve" id="ref-for-blob-url-resolve">resolving the blob URL</a> <var>url</var>, if that did not return
 failure, and null otherwise. </p>
    <li>
     <p>Return <var>url</var>. </p>
   </ol>
   <hr>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="concept-basic-url-parser">basic URL parser</dfn> takes a
string <var>input</var>, optionally with a <a data-link-type="dfn" href="#concept-base-url" id="ref-for-concept-base-url⑥">base URL</a> <var>base</var>, optionally with an <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#encoding" id="ref-for-encoding①">encoding</a> <var>encoding override</var>, optionally with a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url③⑦">URL</a> <var>url</var> and a state override <var>state override</var>, and then runs these steps: </p>
   <div class="note no-backref" role="note">
    <p>The <var>encoding override</var> argument is a legacy concept only relevant for
 HTML. The <var>url</var> and <var>state override</var> arguments are only for use by various APIs. <a data-link-type="biblio" href="#biblio-html">[HTML]</a> </p>
    <p>When the <var>url</var> and <var>state override</var> arguments are not passed, the <a data-link-type="dfn" href="#concept-basic-url-parser" id="ref-for-concept-basic-url-parser②">basic URL parser</a> returns either a new <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url③⑧">URL</a> or failure. If they are passed, the
 algorithm modifies the passed <var>url</var> and can terminate without returning anything. </p>
   </div>
   <ol>
    <li>
     <p>If <var>url</var> is not given: </p>
     <ol>
      <li>
       <p>Set <var>url</var> to a new <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url③⑨">URL</a>. </p>
      <li>
       <p>If <var>input</var> contains any leading or trailing <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#c0-control-or-space" id="ref-for-c0-control-or-space">C0 control or space</a>, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error②⑥">validation error</a>. </p>
      <li>
       <p>Remove any leading and trailing <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#c0-control-or-space" id="ref-for-c0-control-or-space①">C0 control or space</a> from <var>input</var>. </p>
     </ol>
    <li>
     <p>If <var>input</var> contains any <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-tab-or-newline" id="ref-for-ascii-tab-or-newline">ASCII tab or newline</a>, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error②⑦">validation error</a>. </p>
    <li>
     <p>Remove all <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-tab-or-newline" id="ref-for-ascii-tab-or-newline①">ASCII tab or newline</a> from <var>input</var>. </p>
    <li>
     <p>Let <var>state</var> be <var>state override</var> if given, or <a data-link-type="dfn" href="#scheme-start-state" id="ref-for-scheme-start-state">scheme start state</a> otherwise. </p>
    <li>
     <p>If <var>base</var> is not given, set it to null. </p>
    <li>
     <p>Let <var>encoding</var> be <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8" id="ref-for-utf-8①">UTF-8</a>. </p>
    <li>
     <p>If <var>encoding override</var> is given, set <var>encoding</var> to the result of <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#get-an-output-encoding" id="ref-for-get-an-output-encoding">getting an output encoding</a> from <var>encoding override</var>. </p>
    <li>
     <p>Let <var>buffer</var> be the empty string. </p>
    <li>
     <p>Let the <var>@ flag</var>, <var>[] flag</var>, and <var>passwordTokenSeenFlag</var> be
 unset. </p>
    <li>
     <p>Let <var>pointer</var> be a pointer to first code point in <var>input</var>. </p>
    <li>
     <p>Keep running the following state machine by switching on <var>state</var>. If after a run <var>pointer</var> points to the <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point④">EOF code point</a>, go to the next step. Otherwise, increase <var>pointer</var> by one and continue with the state machine. </p>
     <dl class="switch">
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="scheme-start-state">scheme start state</dfn> 
      <dd>
       <ol>
        <li>
         <p>If <a data-link-type="dfn" href="#c" id="ref-for-c①⑤">c</a> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-alpha" id="ref-for-ascii-alpha②">ASCII alpha</a>,
     append <a data-link-type="dfn" href="#c" id="ref-for-c①⑥">c</a>, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-lowercase" id="ref-for-ascii-lowercase">lowercased</a>, to <var>buffer</var>, and
     set <var>state</var> to <a data-link-type="dfn" href="#scheme-state" id="ref-for-scheme-state">scheme state</a>. </p>
        <li>
         <p>Otherwise, if <var>state override</var> is not given, set <var>state</var> to <a data-link-type="dfn" href="#no-scheme-state" id="ref-for-no-scheme-state">no scheme state</a>, and decrease <var>pointer</var> by one. </p>
        <li>
         <p>Otherwise, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error②⑧">validation error</a>, return failure. </p>
         <p class="note" role="note">This indication of failure is used exclusively by <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/history.html#location" id="ref-for-location">Location</a></code> object’s <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/history.html#dom-location-protocol" id="ref-for-dom-location-protocol">protocol</a></code> attribute. </p>
       </ol>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="scheme-state">scheme state</dfn> 
      <dd>
       <ol>
        <li>
         <p>If <a data-link-type="dfn" href="#c" id="ref-for-c①⑦">c</a> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-alphanumeric" id="ref-for-ascii-alphanumeric②">ASCII alphanumeric</a>, U+002B (+), U+002D (-), or U+002E (.),
     append <a data-link-type="dfn" href="#c" id="ref-for-c①⑧">c</a>, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-lowercase" id="ref-for-ascii-lowercase①">lowercased</a>, to <var>buffer</var>. </p>
        <li>
         <p>Otherwise, if <a data-link-type="dfn" href="#c" id="ref-for-c①⑨">c</a> is U+003A (:), then: </p>
         <ol>
          <li>
           <p>If <var>state override</var> is given, then: </p>
           <ol>
            <li>
             <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme①⓪">scheme</a> is a <a data-link-type="dfn" href="#special-scheme" id="ref-for-special-scheme⑧">special scheme</a> and <var>buffer</var> is not a <a data-link-type="dfn" href="#special-scheme" id="ref-for-special-scheme⑨">special scheme</a>, then return. </p>
            <li>
             <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme①①">scheme</a> is not a <a data-link-type="dfn" href="#special-scheme" id="ref-for-special-scheme①⓪">special scheme</a> and <var>buffer</var> is a <a data-link-type="dfn" href="#special-scheme" id="ref-for-special-scheme①①">special scheme</a>, then return. </p>
            <li>
             <p>If <var>url</var> <a data-link-type="dfn" href="#include-credentials" id="ref-for-include-credentials">includes credentials</a> or has a non-null <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port②">port</a>,
         and <var>buffer</var> is "<code>file</code>", then return. </p>
            <li>
             <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme①②">scheme</a> is "<code>file</code>" and its <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host⑤">host</a> is an <a data-link-type="dfn" href="#empty-host" id="ref-for-empty-host⑤">empty host</a> or null, then return. </p>
           </ol>
          <li>
           <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme①③">scheme</a> to <var>buffer</var>. </p>
          <li>
           <p>If <var>state override</var> is given, then: </p>
           <ol>
            <li>
             <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port③">port</a> is <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme①④">scheme</a>’s <a data-link-type="dfn" href="#default-port" id="ref-for-default-port">default port</a>, then set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port④">port</a> to null. </p>
            <li>
             <p>Return. </p>
           </ol>
          <li>
           <p>Set <var>buffer</var> to the empty string. </p>
          <li>
           <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme①⑤">scheme</a> is "<code>file</code>", then: </p>
           <ol>
            <li>
             <p>If <a data-link-type="dfn" href="#remaining" id="ref-for-remaining②">remaining</a> does not start with "<code>//</code>", <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error②⑨">validation error</a>. </p>
            <li>
             <p>Set <var>state</var> to <a data-link-type="dfn" href="#file-state" id="ref-for-file-state">file state</a>. </p>
           </ol>
          <li>
           <p>Otherwise, if <var>url</var> <a data-link-type="dfn" href="#is-special" id="ref-for-is-special①">is special</a>, <var>base</var> is non-null, and <var>base</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme①⑥">scheme</a> is equal to <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme①⑦">scheme</a>,
        set <var>state</var> to <a data-link-type="dfn" href="#special-relative-or-authority-state" id="ref-for-special-relative-or-authority-state">special relative or authority state</a>. </p>
           <p class="note no-backref" role="note">This means that <var>base</var>’s <a data-link-type="dfn" href="#url-cannot-be-a-base-url-flag" id="ref-for-url-cannot-be-a-base-url-flag①">cannot-be-a-base-URL flag</a> is unset. </p>
          <li>
           <p>Otherwise, if <var>url</var> <a data-link-type="dfn" href="#is-special" id="ref-for-is-special②">is special</a>, set <var>state</var> to <a data-link-type="dfn" href="#special-authority-slashes-state" id="ref-for-special-authority-slashes-state">special authority slashes state</a>. </p>
          <li>
           <p>Otherwise, if <a data-link-type="dfn" href="#remaining" id="ref-for-remaining③">remaining</a> starts with an U+002F (/), set <var>state</var> to <a data-link-type="dfn" href="#path-or-authority-state" id="ref-for-path-or-authority-state">path or authority state</a> and increase <var>pointer</var> by one. </p>
          <li>
           <p>Otherwise, set <var>url</var>’s <a data-link-type="dfn" href="#url-cannot-be-a-base-url-flag" id="ref-for-url-cannot-be-a-base-url-flag②">cannot-be-a-base-URL flag</a>, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append">append</a> an empty string to <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path②">path</a>, and set <var>state</var> to <a data-link-type="dfn" href="#cannot-be-a-base-url-path-state" id="ref-for-cannot-be-a-base-url-path-state">cannot-be-a-base-URL path state</a>. </p>
         </ol>
        <li>
         <p>Otherwise, if <var>state override</var> is not given, set <var>buffer</var> to the empty string, <var>state</var> to <a data-link-type="dfn" href="#no-scheme-state" id="ref-for-no-scheme-state①">no scheme state</a>, and start over (from the first code point
     in <var>input</var>). </p>
        <li>
         <p>Otherwise, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error③⓪">validation error</a>, return failure. </p>
         <p class="note" role="note">This indication of failure is used exclusively by <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/history.html#location" id="ref-for-location①">Location</a></code> object’s <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/history.html#dom-location-protocol" id="ref-for-dom-location-protocol①">protocol</a></code> attribute. Furthermore, the non-failure termination earlier in this
      state is an intentional difference for defining that attribute. </p>
       </ol>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="no-scheme-state">no scheme state</dfn> 
      <dd>
       <ol>
        <li>
         <p>If <var>base</var> is null, or <var>base</var>’s <a data-link-type="dfn" href="#url-cannot-be-a-base-url-flag" id="ref-for-url-cannot-be-a-base-url-flag③">cannot-be-a-base-URL flag</a> is set and <a data-link-type="dfn" href="#c" id="ref-for-c②⓪">c</a> is not U+0023 (#), <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error③①">validation error</a>, return failure. </p>
        <li>
         <p>Otherwise, if <var>base</var>’s <a data-link-type="dfn" href="#url-cannot-be-a-base-url-flag" id="ref-for-url-cannot-be-a-base-url-flag④">cannot-be-a-base-URL flag</a> is set and <a data-link-type="dfn" href="#c" id="ref-for-c②①">c</a> is U+0023 (#), set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme①⑧">scheme</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme①⑨">scheme</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path③">path</a> to a copy of <var>base</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path④">path</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query①">query</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query②">query</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-fragment" id="ref-for-concept-url-fragment">fragment</a> to the empty string, set <var>url</var>’s <a data-link-type="dfn" href="#url-cannot-be-a-base-url-flag" id="ref-for-url-cannot-be-a-base-url-flag⑤">cannot-be-a-base-URL flag</a>, and set <var>state</var> to <a data-link-type="dfn" href="#fragment-state" id="ref-for-fragment-state">fragment state</a>. </p>
        <li>
         <p>Otherwise, if <var>base</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme②⓪">scheme</a> is not
     "<code>file</code>", set <var>state</var> to <a data-link-type="dfn" href="#relative-state" id="ref-for-relative-state">relative state</a> and decrease <var>pointer</var> by one. </p>
        <li>
         <p>Otherwise, set <var>state</var> to <a data-link-type="dfn" href="#file-state" id="ref-for-file-state①">file state</a> and decrease <var>pointer</var> by one. </p>
       </ol>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="special-relative-or-authority-state">special relative or authority state</dfn> 
      <dd>
       <p>If <a data-link-type="dfn" href="#c" id="ref-for-c②②">c</a> is U+002F (/) and <a data-link-type="dfn" href="#remaining" id="ref-for-remaining④">remaining</a> starts with U+002F (/), then set <var>state</var> to <a data-link-type="dfn" href="#special-authority-ignore-slashes-state" id="ref-for-special-authority-ignore-slashes-state">special authority ignore slashes state</a> and increase <var>pointer</var> by one. </p>
       <p>Otherwise, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error③②">validation error</a>, set <var>state</var> to <a data-link-type="dfn" href="#relative-state" id="ref-for-relative-state①">relative state</a> and
    decrease <var>pointer</var> by one. </p>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="path-or-authority-state">path or authority state</dfn> 
      <dd>
       <p>If <a data-link-type="dfn" href="#c" id="ref-for-c②③">c</a> is U+002F (/), then set <var>state</var> to <a data-link-type="dfn" href="#authority-state" id="ref-for-authority-state">authority state</a>. </p>
       <p>Otherwise, set <var>state</var> to <a data-link-type="dfn" href="#path-state" id="ref-for-path-state">path state</a>, and decrease <var>pointer</var> by one. </p>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="relative-state">relative state</dfn> 
      <dd>
       <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme②①">scheme</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme②②">scheme</a>, and then, switching on <a data-link-type="dfn" href="#c" id="ref-for-c②④">c</a>: </p>
       <dl class="switch">
        <dt>The <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point⑤">EOF code point</a> 
        <dd>
         <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username②">username</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username③">username</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password②">password</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password③">password</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host⑥">host</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host⑦">host</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port⑤">port</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port⑥">port</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path⑤">path</a> to a copy of <var>base</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path⑥">path</a>, and <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query③">query</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query④">query</a>. </p>
        <dt>U+002F (/) 
        <dd>
         <p>Set <var>state</var> to <a data-link-type="dfn" href="#relative-slash-state" id="ref-for-relative-slash-state">relative slash state</a>. </p>
        <dt>U+003F (?) 
        <dd>
         <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username④">username</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username⑤">username</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password④">password</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password⑤">password</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host⑧">host</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host⑨">host</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port⑦">port</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port⑧">port</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path⑦">path</a> to a copy of <var>base</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path⑧">path</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query⑤">query</a> to the empty string,
     and <var>state</var> to <a data-link-type="dfn" href="#query-state" id="ref-for-query-state">query state</a>. </p>
        <dt>U+0023 (#) 
        <dd>
         <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username⑥">username</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username⑦">username</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password⑥">password</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password⑦">password</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host①⓪">host</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host①①">host</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port⑨">port</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port①⓪">port</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path⑨">path</a> to a copy of <var>base</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path①⓪">path</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query⑥">query</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query⑦">query</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-fragment" id="ref-for-concept-url-fragment①">fragment</a> to the empty string,
     and <var>state</var> to <a data-link-type="dfn" href="#fragment-state" id="ref-for-fragment-state①">fragment state</a>. </p>
        <dt>Otherwise 
        <dd>
         <p>If <var>url</var> <a data-link-type="dfn" href="#is-special" id="ref-for-is-special③">is special</a> and <a data-link-type="dfn" href="#c" id="ref-for-c②⑤">c</a> is U+005C (\), <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error③③">validation error</a>,
      set <var>state</var> to <a data-link-type="dfn" href="#relative-slash-state" id="ref-for-relative-slash-state①">relative slash state</a>. </p>
         <p>Otherwise, run these steps: </p>
         <ol>
          <li>
           <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username⑧">username</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username⑨">username</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password⑧">password</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password⑨">password</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host①②">host</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host①③">host</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port①①">port</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port①②">port</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path①①">path</a> to a copy of <var>base</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path①②">path</a>, and then <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-remove" id="ref-for-list-remove①">remove</a> <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path①③">path</a>’s last item, if any. </p>
          <li>
           <p>Set <var>state</var> to <a data-link-type="dfn" href="#path-state" id="ref-for-path-state①">path state</a>,
       and decrease <var>pointer</var> by one. </p>
         </ol>
       </dl>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="relative-slash-state">relative slash state</dfn> 
      <dd>
       <ol>
        <li>
         <p>If <var>url</var> <a data-link-type="dfn" href="#is-special" id="ref-for-is-special④">is special</a> and <a data-link-type="dfn" href="#c" id="ref-for-c②⑥">c</a> is U+002F (/) or U+005C (\), then: </p>
         <ol>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c②⑦">c</a> is U+005C (\), <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error③④">validation error</a>. </p>
          <li>
           <p>Set <var>state</var> to <a data-link-type="dfn" href="#special-authority-ignore-slashes-state" id="ref-for-special-authority-ignore-slashes-state①">special authority ignore slashes state</a>. </p>
         </ol>
        <li>
         <p>Otherwise, if <a data-link-type="dfn" href="#c" id="ref-for-c②⑧">c</a> is U+002F (/), then set <var>state</var> to <a data-link-type="dfn" href="#authority-state" id="ref-for-authority-state①">authority state</a>. </p>
        <li>
         <p>Otherwise, set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username①⓪">username</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username①①">username</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password①⓪">password</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password①①">password</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host①④">host</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host①⑤">host</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port①③">port</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port①④">port</a>, <var>state</var> to <a data-link-type="dfn" href="#path-state" id="ref-for-path-state②">path state</a>, and then, decrease <var>pointer</var> by one. </p>
       </ol>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="special-authority-slashes-state">special authority slashes state</dfn> 
      <dd>
       <p>If <a data-link-type="dfn" href="#c" id="ref-for-c②⑨">c</a> is U+002F (/) and <a data-link-type="dfn" href="#remaining" id="ref-for-remaining⑤">remaining</a> starts with U+002F (/), then set <var>state</var> to <a data-link-type="dfn" href="#special-authority-ignore-slashes-state" id="ref-for-special-authority-ignore-slashes-state②">special authority ignore slashes state</a> and increase <var>pointer</var> by one. </p>
       <p>Otherwise, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error③⑤">validation error</a>, set <var>state</var> to <a data-link-type="dfn" href="#special-authority-ignore-slashes-state" id="ref-for-special-authority-ignore-slashes-state③">special authority ignore slashes state</a>, and decrease <var>pointer</var> by one. </p>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="special-authority-ignore-slashes-state">special authority ignore slashes state</dfn> 
      <dd>
       <p>If <a data-link-type="dfn" href="#c" id="ref-for-c③⓪">c</a> is neither U+002F (/) nor U+005C (\), then set <var>state</var> to <a data-link-type="dfn" href="#authority-state" id="ref-for-authority-state②">authority state</a> and decrease <var>pointer</var> by one. </p>
       <p>Otherwise, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error③⑥">validation error</a>. </p>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="authority-state">authority state</dfn> 
      <dd>
       <ol>
        <li>
         <p>If <a data-link-type="dfn" href="#c" id="ref-for-c③①">c</a> is U+0040 (@), then: </p>
         <ol>
          <li>
           <p><a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error③⑦">Validation error</a>. </p>
          <li>
           <p>If the <var>@ flag</var> is set, prepend "<code>%40</code>" to <var>buffer</var>. </p>
          <li>
           <p>Set the <var>@ flag</var>. </p>
          <li>
           <p>For each <var>codePoint</var> in <var>buffer</var>: </p>
           <ol>
            <li>
             <p>If <var>codePoint</var> is U+003A (:) and <var>passwordTokenSeenFlag</var> is
         unset, then set <var>passwordTokenSeenFlag</var> and <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#iteration-continue" id="ref-for-iteration-continue③">continue</a>. </p>
            <li>
             <p>Let <var>encodedCodePoints</var> be the result of running <a data-link-type="dfn" href="#utf-8-percent-encode" id="ref-for-utf-8-percent-encode①">UTF-8 percent encode</a> <var>codePoint</var> using the <a data-link-type="dfn" href="#userinfo-percent-encode-set" id="ref-for-userinfo-percent-encode-set">userinfo percent-encode set</a>. </p>
            <li>
             <p>If <var>passwordTokenSeenFlag</var> is set, then append <var>encodedCodePoints</var> to <var>url</var>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password①②">password</a>. </p>
            <li>
             <p>Otherwise, append <var>encodedCodePoints</var> to <var>url</var>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username①②">username</a>. </p>
           </ol>
          <li>
           <p>Set <var>buffer</var> to the empty string. </p>
         </ol>
        <li>
         <p>Otherwise, if one of the following is true </p>
         <ul class="brief">
          <li>
           <p><a data-link-type="dfn" href="#c" id="ref-for-c③②">c</a> is the <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point⑥">EOF code point</a>, U+002F (/), U+003F (?), or U+0023 (#) </p>
          <li>
           <p><var>url</var> <a data-link-type="dfn" href="#is-special" id="ref-for-is-special⑤">is special</a> and <a data-link-type="dfn" href="#c" id="ref-for-c③③">c</a> is U+005C (\) </p>
         </ul>
         <p>then: </p>
         <ol>
          <li>
           <p>If <var>@ flag</var> is set and <var>buffer</var> is the empty string, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error③⑧">validation error</a>, return failure. </p>
          <li>
           <p>Decrease <var>pointer</var> by the number of code points in <var>buffer</var> plus
       one, set <var>buffer</var> to the empty string, and set <var>state</var> to <a data-link-type="dfn" href="#host-state" id="ref-for-host-state">host state</a>. </p>
         </ol>
        <li>
         <p>Otherwise, append <a data-link-type="dfn" href="#c" id="ref-for-c③④">c</a> to <var>buffer</var>. </p>
       </ol>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="host-state">host state</dfn> 
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="hostname-state">hostname state</dfn> 
      <dd>
       <ol>
        <li>
         <p>If <var>state override</var> is given and <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme②③">scheme</a> is
     "<code>file</code>", then decrease <var>pointer</var> by one and set <var>state</var> to <a data-link-type="dfn" href="#file-host-state" id="ref-for-file-host-state">file host state</a>. </p>
        <li>
         <p>Otherwise, if <a data-link-type="dfn" href="#c" id="ref-for-c③⑤">c</a> is U+003A (:) and the <var>[] flag</var> is unset, then: </p>
         <ol>
          <li>
           <p>If <var>buffer</var> is the empty string, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error③⑨">validation error</a>, return failure. </p>
          <li>
           <p>Let <var>host</var> be the result of <a data-link-type="dfn" href="#concept-host-parser" id="ref-for-concept-host-parser④">host parsing</a> <var>buffer</var> with <var>url</var> <a data-link-type="dfn" href="#is-not-special" id="ref-for-is-not-special">is not special</a>. </p>
          <li>
           <p>If <var>host</var> is failure, then return failure. </p>
          <li>
           <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host①⑥">host</a> to <var>host</var>, <var>buffer</var> to the empty string,
       and <var>state</var> to <a data-link-type="dfn" href="#port-state" id="ref-for-port-state">port state</a>. </p>
          <li>
           <p>If <var>state override</var> is given and <var>state override</var> is <a data-link-type="dfn" href="#hostname-state" id="ref-for-hostname-state">hostname state</a>, then return. </p>
         </ol>
        <li>
         <p>Otherwise, if one of the following is true </p>
         <ul class="brief">
          <li>
           <p><a data-link-type="dfn" href="#c" id="ref-for-c③⑥">c</a> is the <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point⑦">EOF code point</a>, U+002F (/), U+003F (?), or U+0023 (#) </p>
          <li>
           <p><var>url</var> <a data-link-type="dfn" href="#is-special" id="ref-for-is-special⑥">is special</a> and <a data-link-type="dfn" href="#c" id="ref-for-c③⑦">c</a> is U+005C (\) </p>
         </ul>
         <p>then decrease <var>pointer</var> by one, and then: </p>
         <ol>
          <li>
           <p>If <var>url</var> <a data-link-type="dfn" href="#is-special" id="ref-for-is-special⑦">is special</a> and <var>buffer</var> is the empty string, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error④⓪">validation error</a>, return failure. </p>
          <li>
           <p>Otherwise, if <var>state override</var> is given, <var>buffer</var> is the empty
       string, and either <var>url</var> <a data-link-type="dfn" href="#include-credentials" id="ref-for-include-credentials①">includes credentials</a> or <var>url</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port①⑤">port</a> is non-null, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error④①">validation error</a>, return. </p>
          <li>
           <p>Let <var>host</var> be the result of <a data-link-type="dfn" href="#concept-host-parser" id="ref-for-concept-host-parser⑤">host parsing</a> <var>buffer</var> with <var>url</var> <a data-link-type="dfn" href="#is-not-special" id="ref-for-is-not-special①">is not special</a>. </p>
          <li>
           <p>If <var>host</var> is failure, then return failure. </p>
          <li>
           <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host①⑦">host</a> to <var>host</var>, <var>buffer</var> to the empty string,
       and <var>state</var> to <a data-link-type="dfn" href="#path-start-state" id="ref-for-path-start-state">path start state</a>. </p>
          <li>
           <p>If <var>state override</var> is given, then return. </p>
         </ol>
        <li>
         <p>Otherwise: </p>
         <ol>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c③⑧">c</a> is U+005B ([), then set the <var>[] flag</var>. </p>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c③⑨">c</a> is U+005D (]), then unset the <var>[] flag</var>. </p>
          <li>
           <p>Append <a data-link-type="dfn" href="#c" id="ref-for-c④⓪">c</a> to <var>buffer</var>. </p>
         </ol>
       </ol>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="port-state">port state</dfn> 
      <dd>
       <ol>
        <li>
         <p>If <a data-link-type="dfn" href="#c" id="ref-for-c④①">c</a> is an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-digit" id="ref-for-ascii-digit④">ASCII digit</a>, append <a data-link-type="dfn" href="#c" id="ref-for-c④②">c</a> to <var>buffer</var>. </p>
        <li>
         <p>Otherwise, if one of the following is true </p>
         <ul class="brief">
          <li>
           <p><a data-link-type="dfn" href="#c" id="ref-for-c④③">c</a> is the <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point⑧">EOF code point</a>, U+002F (/), U+003F (?), or U+0023 (#) </p>
          <li>
           <p><var>url</var> <a data-link-type="dfn" href="#is-special" id="ref-for-is-special⑧">is special</a> and <a data-link-type="dfn" href="#c" id="ref-for-c④④">c</a> is U+005C (\) </p>
          <li>
           <p><var>state override</var> is given </p>
         </ul>
         <p>then: </p>
         <ol>
          <li>
           <p>If <var>buffer</var> is not the empty string, then: </p>
           <ol>
            <li>
             <p>Let <var>port</var> be the mathematical integer value that is represented
         by <var>buffer</var> in radix-10 using <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-digit" id="ref-for-ascii-digit⑤">ASCII digits</a> for digits with values
         0 through 9. </p>
            <li>
             <p>If <var>port</var> is greater than 2<sup>16</sup> − 1, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error④②">validation error</a>, return failure. </p>
            <li>
             <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port①⑥">port</a> to null, if <var>port</var> is <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme②④">scheme</a>’s <a data-link-type="dfn" href="#default-port" id="ref-for-default-port①">default port</a>, and to <var>port</var> otherwise. </p>
            <li>
             <p>Set <var>buffer</var> to the empty string. </p>
           </ol>
          <li>
           <p>If <var>state override</var> is given, then return. </p>
          <li>
           <p>Set <var>state</var> to <a data-link-type="dfn" href="#path-start-state" id="ref-for-path-start-state①">path start state</a>, and decrease <var>pointer</var> by one. </p>
         </ol>
        <li>
         <p>Otherwise, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error④③">validation error</a>, return failure. </p>
       </ol>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="file-state">file state</dfn> 
      <dd>
       <ol>
        <li>
         <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme②⑤">scheme</a> to "<code>file</code>". </p>
        <li>
         <p>If <a data-link-type="dfn" href="#c" id="ref-for-c④⑤">c</a> is U+002F (/) or U+005C (\), then: </p>
         <ol>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c④⑥">c</a> is U+005C (\), <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error④④">validation error</a>. </p>
          <li>
           <p>Set <var>state</var> to <a data-link-type="dfn" href="#file-slash-state" id="ref-for-file-slash-state">file slash state</a>. </p>
         </ol>
        <li>
         <p>Otherwise, if <var>base</var> is non-null and <var>base</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme②⑥">scheme</a> is
      "<code>file</code>", switch on <a data-link-type="dfn" href="#c" id="ref-for-c④⑦">c</a>: </p>
         <dl class="switch">
          <dt>The <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point⑨">EOF code point</a> 
          <dd>
           <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host①⑧">host</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host①⑨">host</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path①④">path</a> to a copy of <var>base</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path①⑤">path</a>, and <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query⑧">query</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query⑨">query</a>. </p>
          <dt>U+003F (?) 
          <dd>
           <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host②⓪">host</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host②①">host</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path①⑥">path</a> to a copy of <var>base</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path①⑦">path</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query①⓪">query</a> to the empty string, and <var>state</var> to <a data-link-type="dfn" href="#query-state" id="ref-for-query-state①">query state</a>. </p>
          <dt>U+0023 (#) 
          <dd>
           <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host②②">host</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host②③">host</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path①⑧">path</a> to a copy of <var>base</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path①⑨">path</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query①①">query</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query①②">query</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-fragment" id="ref-for-concept-url-fragment②">fragment</a> to the empty string, and <var>state</var> to <a data-link-type="dfn" href="#fragment-state" id="ref-for-fragment-state②">fragment state</a>. </p>
          <dt>Otherwise 
          <dd>
           <ol>
            <li>
             <p>If the substring from <var>pointer</var> in <var>input</var> does not <a data-link-type="dfn" href="#start-with-a-windows-drive-letter" id="ref-for-start-with-a-windows-drive-letter">start with a Windows drive letter</a>, then set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host②④">host</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host②⑤">host</a>, <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path②⓪">path</a> to a copy of <var>base</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path②①">path</a>, and then <a data-link-type="dfn" href="#shorten-a-urls-path" id="ref-for-shorten-a-urls-path">shorten</a> <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path②②">path</a>. </p>
             <p class="note" role="note">This is a (platform-independent) Windows drive letter quirk. </p>
            <li>
             <p>Otherwise, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error④⑤">validation error</a>. </p>
            <li>
             <p>Set <var>state</var> to <a data-link-type="dfn" href="#path-state" id="ref-for-path-state③">path state</a>, and decrease <var>pointer</var> by one. </p>
           </ol>
         </dl>
        <li>
         <p>Otherwise, set <var>state</var> to <a data-link-type="dfn" href="#path-state" id="ref-for-path-state④">path state</a>, and decrease <var>pointer</var> by
     one. </p>
       </ol>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="file-slash-state">file slash state</dfn> 
      <dd>
       <ol>
        <li>
         <p>If <a data-link-type="dfn" href="#c" id="ref-for-c④⑧">c</a> is U+002F (/) or U+005C (\), then: </p>
         <ol>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c④⑨">c</a> is U+005C (\), <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error④⑥">validation error</a>. </p>
          <li>
           <p>Set <var>state</var> to <a data-link-type="dfn" href="#file-host-state" id="ref-for-file-host-state①">file host state</a>. </p>
         </ol>
        <li>
         <p>Otherwise: </p>
         <ol>
          <li>
           <p>If <var>base</var> is non-null, <var>base</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme②⑦">scheme</a> is
        "<code>file</code>", and the substring from <var>pointer</var> in <var>input</var> does not <a data-link-type="dfn" href="#start-with-a-windows-drive-letter" id="ref-for-start-with-a-windows-drive-letter①">start with a Windows drive letter</a>, then: </p>
           <ol>
            <li>
             <p>If <var>base</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path②③">path</a>[0] is a <a data-link-type="dfn" href="#normalized-windows-drive-letter" id="ref-for-normalized-windows-drive-letter②">normalized Windows drive letter</a>, then <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append①">append</a> <var>base</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path②④">path</a>[0] to <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path②⑤">path</a>. </p>
             <p class="note" role="note">This is a (platform-independent) Windows drive letter quirk. Both <var>url</var>’s and <var>base</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host②⑥">host</a> are null under these conditions
          and therefore not copied. </p>
            <li>
             <p>Otherwise, set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host②⑦">host</a> to <var>base</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host②⑧">host</a>. </p>
           </ol>
          <li>
           <p>Set <var>state</var> to <a data-link-type="dfn" href="#path-state" id="ref-for-path-state⑤">path state</a>, and decrease <var>pointer</var> by one. </p>
         </ol>
       </ol>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="file-host-state">file host state</dfn> 
      <dd>
       <ol>
        <li>
         <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑤⓪">c</a> is the <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point①⓪">EOF code point</a>, U+002F (/), U+005C (\), U+003F (?), or
      U+0023 (#), then decrease <var>pointer</var> by one and then: </p>
         <ol>
          <li>
           <p>If <var>state override</var> is not given and <var>buffer</var> is a <a data-link-type="dfn" href="#windows-drive-letter" id="ref-for-windows-drive-letter③">Windows drive letter</a>, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error④⑦">validation error</a>, set <var>state</var> to <a data-link-type="dfn" href="#path-state" id="ref-for-path-state⑥">path state</a>. </p>
           <p class="note" role="note">This is a (platform-independent) Windows drive letter quirk. <var>buffer</var> is not reset here and instead used in the <a data-link-type="dfn" href="#path-state" id="ref-for-path-state⑦">path state</a>. </p>
          <li>
           <p>Otherwise, if <var>buffer</var> is the empty string, then: </p>
           <ol>
            <li>
             <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host②⑨">host</a> to the empty string. </p>
            <li>
             <p>If <var>state override</var> is given, then return. </p>
            <li>
             <p>Set <var>state</var> to <a data-link-type="dfn" href="#path-start-state" id="ref-for-path-start-state②">path start state</a>. </p>
           </ol>
          <li>
           <p>Otherwise, run these steps: </p>
           <ol>
            <li>
             <p>Let <var>host</var> be the result of <a data-link-type="dfn" href="#concept-host-parser" id="ref-for-concept-host-parser⑥">host parsing</a> <var>buffer</var> with <var>url</var> <a data-link-type="dfn" href="#is-not-special" id="ref-for-is-not-special②">is not special</a>. </p>
            <li>
             <p>If <var>host</var> is failure, then return failure. </p>
            <li>
             <p>If <var>host</var> is "<code title>localhost</code>", then set <var>host</var> to
         the empty string. </p>
            <li>
             <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host③⓪">host</a> to <var>host</var>. </p>
            <li>
             <p>If <var>state override</var> is given, then return. </p>
            <li>
             <p>Set <var>buffer</var> to the empty string and <var>state</var> to <a data-link-type="dfn" href="#path-start-state" id="ref-for-path-start-state③">path start state</a>. </p>
           </ol>
         </ol>
        <li>
         <p>Otherwise, append <a data-link-type="dfn" href="#c" id="ref-for-c⑤①">c</a> to <var>buffer</var>. </p>
       </ol>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="path-start-state">path start state</dfn> 
      <dd>
       <ol>
        <li>
         <p>If <var>url</var> <a data-link-type="dfn" href="#is-special" id="ref-for-is-special⑨">is special</a>, then: </p>
         <ol>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑤②">c</a> is U+005C (\), <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error④⑧">validation error</a>. </p>
          <li>
           <p>Set <var>state</var> to <a data-link-type="dfn" href="#path-state" id="ref-for-path-state⑧">path state</a>. </p>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑤③">c</a> is neither U+002F (/) nor U+005C (\), then decrease <var>pointer</var> by
       one. </p>
         </ol>
        <li>
         <p>Otherwise, if <var>state override</var> is not given and <a data-link-type="dfn" href="#c" id="ref-for-c⑤④">c</a> is U+003F (?), set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query①③">query</a> to the empty string and <var>state</var> to <a data-link-type="dfn" href="#query-state" id="ref-for-query-state②">query state</a>. </p>
        <li>
         <p>Otherwise, if <var>state override</var> is not given and <a data-link-type="dfn" href="#c" id="ref-for-c⑤⑤">c</a> is U+0023 (#), set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-fragment" id="ref-for-concept-url-fragment③">fragment</a> to the empty string and <var>state</var> to <a data-link-type="dfn" href="#fragment-state" id="ref-for-fragment-state③">fragment state</a>. </p>
        <li>
         <p>Otherwise, if <a data-link-type="dfn" href="#c" id="ref-for-c⑤⑥">c</a> is not the <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point①①">EOF code point</a>: </p>
         <ol>
          <li>
           <p>Set <var>state</var> to <a data-link-type="dfn" href="#path-state" id="ref-for-path-state⑨">path state</a>. </p>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑤⑦">c</a> is not U+002F (/), then decrease <var>pointer</var> by one. </p>
         </ol>
       </ol>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="path-state">path state</dfn> 
      <dd>
       <ol>
        <li>
         <p>If one of the following is true </p>
         <ul class="brief">
          <li>
           <p><a data-link-type="dfn" href="#c" id="ref-for-c⑤⑧">c</a> is the <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point①②">EOF code point</a> or U+002F (/) </p>
          <li>
           <p><var>url</var> <a data-link-type="dfn" href="#is-special" id="ref-for-is-special①⓪">is special</a> and <a data-link-type="dfn" href="#c" id="ref-for-c⑤⑨">c</a> is U+005C (\) </p>
          <li>
           <p><var>state override</var> is not given and <a data-link-type="dfn" href="#c" id="ref-for-c⑥⓪">c</a> is U+003F (?) or U+0023 (#) </p>
         </ul>
         <p>then: </p>
         <ol>
          <li>
           <p>If <var>url</var> <a data-link-type="dfn" href="#is-special" id="ref-for-is-special①①">is special</a> and <a data-link-type="dfn" href="#c" id="ref-for-c⑥①">c</a> is U+005C (\), <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error④⑨">validation error</a>. </p>
          <li>
           <p>If <var>buffer</var> is a <a data-link-type="dfn" href="#double-dot-path-segment" id="ref-for-double-dot-path-segment②">double-dot path segment</a>, <a data-link-type="dfn" href="#shorten-a-urls-path" id="ref-for-shorten-a-urls-path①">shorten</a> <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path②⑥">path</a>, and then if neither <a data-link-type="dfn" href="#c" id="ref-for-c⑥②">c</a> is U+002F (/), nor <var>url</var> <a data-link-type="dfn" href="#is-special" id="ref-for-is-special①②">is special</a> and <a data-link-type="dfn" href="#c" id="ref-for-c⑥③">c</a> is U+005C (\), <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append②">append</a> the empty string to <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path②⑦">path</a>. </p>
          <li>
           <p>Otherwise, if <var>buffer</var> is a <a data-link-type="dfn" href="#single-dot-path-segment" id="ref-for-single-dot-path-segment②">single-dot path segment</a> and if neither <a data-link-type="dfn" href="#c" id="ref-for-c⑥④">c</a> is U+002F (/), nor <var>url</var> <a data-link-type="dfn" href="#is-special" id="ref-for-is-special①③">is special</a> and <a data-link-type="dfn" href="#c" id="ref-for-c⑥⑤">c</a> is U+005C (\), <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append③">append</a> the empty string to <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path②⑧">path</a>. </p>
          <li>
           <p>Otherwise, if <var>buffer</var> is not a <a data-link-type="dfn" href="#single-dot-path-segment" id="ref-for-single-dot-path-segment③">single-dot path segment</a>, then: </p>
           <ol>
            <li>
             <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme②⑧">scheme</a> is "<code>file</code>", <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path②⑨">path</a> <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty②">is empty</a>, and <var>buffer</var> is a <a data-link-type="dfn" href="#windows-drive-letter" id="ref-for-windows-drive-letter④">Windows drive letter</a>, then: </p>
             <ol>
              <li>
               <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host③①">host</a> is neither the empty string nor null, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑤⓪">validation error</a>, set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host③②">host</a> to the empty string. </p>
              <li>
               <p>Replace the second code point in <var>buffer</var> with U+003A (:). </p>
             </ol>
             <p class="note" role="note">This is a (platform-independent) Windows drive letter quirk. </p>
            <li>
             <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append④">Append</a> <var>buffer</var> to <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path③⓪">path</a>. </p>
           </ol>
          <li>
           <p>Set <var>buffer</var> to the empty string. </p>
          <li>
           <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme②⑨">scheme</a> is "<code>file</code>" and <a data-link-type="dfn" href="#c" id="ref-for-c⑥⑥">c</a> is the <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point①③">EOF code point</a>, U+003F (?), or U+0023 (#), then while <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path③①">path</a>’s <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-size" id="ref-for-list-size①">size</a> is greater than 1 and <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path③②">path</a>[0] is the empty string, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑤①">validation error</a>, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-remove" id="ref-for-list-remove②">remove</a> the first <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-item" id="ref-for-list-item">item</a> from <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path③③">path</a>. </p>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑥⑦">c</a> is U+003F (?), then set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query①④">query</a> to the empty
       string and <var>state</var> to <a data-link-type="dfn" href="#query-state" id="ref-for-query-state③">query state</a>. </p>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑥⑧">c</a> is U+0023 (#), then set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-fragment" id="ref-for-concept-url-fragment④">fragment</a> to the
       empty string and <var>state</var> to <a data-link-type="dfn" href="#fragment-state" id="ref-for-fragment-state④">fragment state</a>. </p>
         </ol>
        <li>
         <p>Otherwise, run these steps: </p>
         <ol>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑥⑨">c</a> is not a <a data-link-type="dfn" href="#url-code-points" id="ref-for-url-code-points②">URL code point</a> and not U+0025 (%), <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑤②">validation error</a>. </p>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑦⓪">c</a> is U+0025 (%) and <a data-link-type="dfn" href="#remaining" id="ref-for-remaining⑥">remaining</a> does not start with two <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-hex-digit" id="ref-for-ascii-hex-digit③">ASCII hex digits</a>, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑤③">validation error</a>. </p>
          <li>
           <p><a data-link-type="dfn" href="#utf-8-percent-encode" id="ref-for-utf-8-percent-encode②">UTF-8 percent encode</a> <a data-link-type="dfn" href="#c" id="ref-for-c⑦①">c</a> using the <a data-link-type="dfn" href="#path-percent-encode-set" id="ref-for-path-percent-encode-set①">path percent-encode set</a>, and
       append the result to <var>buffer</var>. </p>
         </ol>
       </ol>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="cannot-be-a-base-url-path-state">cannot-be-a-base-URL path state</dfn> 
      <dd>
       <ol>
        <li>
         <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑦②">c</a> is U+003F (?), then set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query①⑤">query</a> to the empty
     string and <var>state</var> to <a data-link-type="dfn" href="#query-state" id="ref-for-query-state④">query state</a>. </p>
        <li>
         <p>Otherwise, if <a data-link-type="dfn" href="#c" id="ref-for-c⑦③">c</a> is U+0023 (#), then set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-fragment" id="ref-for-concept-url-fragment⑤">fragment</a> to the empty string and <var>state</var> to <a data-link-type="dfn" href="#fragment-state" id="ref-for-fragment-state⑤">fragment state</a>. </p>
        <li>
         <p>Otherwise: </p>
         <ol>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑦④">c</a> is not the <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point①④">EOF code point</a>, not a <a data-link-type="dfn" href="#url-code-points" id="ref-for-url-code-points③">URL code point</a>, and not
       U+0025 (%), <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑤④">validation error</a>. </p>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑦⑤">c</a> is U+0025 (%) and <a data-link-type="dfn" href="#remaining" id="ref-for-remaining⑦">remaining</a> does not start with two <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-hex-digit" id="ref-for-ascii-hex-digit④">ASCII hex digits</a>, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑤⑤">validation error</a>. </p>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑦⑥">c</a> is not the <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point①⑤">EOF code point</a>, <a data-link-type="dfn" href="#utf-8-percent-encode" id="ref-for-utf-8-percent-encode③">UTF-8 percent encode</a> <a data-link-type="dfn" href="#c" id="ref-for-c⑦⑦">c</a> using the <a data-link-type="dfn" href="#c0-control-percent-encode-set" id="ref-for-c0-control-percent-encode-set②">C0 control percent-encode set</a>, and append the result to <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path③④">path</a>[0]. </p>
         </ol>
       </ol>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="query-state">query state</dfn> 
      <dd>
       <ol>
        <li>
         <p>If <var>encoding</var> is not <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8" id="ref-for-utf-8②">UTF-8</a> and one of the following is true </p>
         <ul class="brief">
          <li>
           <p><var>url</var> <a data-link-type="dfn" href="#is-not-special" id="ref-for-is-not-special③">is not special</a> </p>
          <li>
           <p><var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme③⓪">scheme</a> is "<code>ws</code>" or "<code>wss</code>" </p>
         </ul>
         <p>then set <var>encoding</var> to <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8" id="ref-for-utf-8③">UTF-8</a>. </p>
        <li>
         <p>If <var>state override</var> is not given and <a data-link-type="dfn" href="#c" id="ref-for-c⑦⑧">c</a> is U+0023 (#), then set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-fragment" id="ref-for-concept-url-fragment⑥">fragment</a> to the empty string and state to <a data-link-type="dfn" href="#fragment-state" id="ref-for-fragment-state⑥">fragment state</a>. </p>
        <li>
         <p>Otherwise, if <a data-link-type="dfn" href="#c" id="ref-for-c⑦⑨">c</a> is not the <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point①⑥">EOF code point</a>: </p>
         <ol>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑧⓪">c</a> is not a <a data-link-type="dfn" href="#url-code-points" id="ref-for-url-code-points④">URL code point</a> and not U+0025 (%), <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑤⑥">validation error</a>. </p>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑧①">c</a> is U+0025 (%) and <a data-link-type="dfn" href="#remaining" id="ref-for-remaining⑧">remaining</a> does not start with two <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-hex-digit" id="ref-for-ascii-hex-digit⑤">ASCII hex digits</a>, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑤⑦">validation error</a>. </p>
          <li>
           <p>Let <var>bytes</var> be the result of <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#encode" id="ref-for-encode">encoding</a> <a data-link-type="dfn" href="#c" id="ref-for-c⑧②">c</a> using <var>encoding</var>. </p>
          <li>
           <p>If <var>bytes</var> starts with `<code>&amp;#</code>` and ends with 0x3B (;), then: </p>
           <ol>
            <li>
             <p>Replace `<code>&amp;#</code>` at the start of <var>bytes</var> with
         `<code>%26%23</code>`. </p>
            <li>
             <p>Replace 0x3B (;) at the end of <var>bytes</var> with `<code>%3B</code>`. </p>
            <li>
             <p>Append <var>bytes</var>, <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#isomorphic-decode" id="ref-for-isomorphic-decode">isomorphic decoded</a>, to <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query①⑥">query</a>. </p>
           </ol>
           <p class="note no-backref" role="note">This can happen when <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#encode" id="ref-for-encode①">encoding</a> code points using
        a non-<a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8" id="ref-for-utf-8④">UTF-8</a> <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#encoding" id="ref-for-encoding②">encoding</a>. </p>
          <li>
           <p>Otherwise, for each <var>byte</var> in <var>bytes</var>: </p>
           <ol>
            <li>
             <p>If one of the following is true </p>
             <ul class="brief">
              <li>
               <p><var>byte</var> is less than 0x21 (!) </p>
              <li>
               <p><var>byte</var> is greater than 0x7E (~) </p>
              <li>
               <p><var>byte</var> is 0x22 ("), 0x23 (#), 0x3C (&lt;), or 0x3E (>) </p>
              <li>
               <p><var>byte</var> is 0x27 (') and <var>url</var> <a data-link-type="dfn" href="#is-special" id="ref-for-is-special①④">is special</a> </p>
             </ul>
             <p>then append <var>byte</var>, <a data-link-type="dfn" href="#percent-encode" id="ref-for-percent-encode①">percent encoded</a>, to <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query①⑦">query</a>. </p>
            <li>
             <p>Otherwise, append a code point whose value is <var>byte</var> to <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query①⑧">query</a>. </p>
           </ol>
         </ol>
       </ol>
      <dt><dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="fragment-state">fragment state</dfn> 
      <dd>
       <p>Switching on <a data-link-type="dfn" href="#c" id="ref-for-c⑧③">c</a>: </p>
       <dl class="switch">
        <dt>The <a data-link-type="dfn" href="#eof-code-point" id="ref-for-eof-code-point①⑦">EOF code point</a> 
        <dd>
         <p>Do nothing. </p>
        <dt>U+0000 NULL 
        <dd>
         <p><a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑤⑧">Validation error</a>. </p>
        <dt>Otherwise 
        <dd>
         <ol>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑧④">c</a> is not a <a data-link-type="dfn" href="#url-code-points" id="ref-for-url-code-points⑤">URL code point</a> and not U+0025 (%), <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑤⑨">validation error</a>. </p>
          <li>
           <p>If <a data-link-type="dfn" href="#c" id="ref-for-c⑧⑤">c</a> is U+0025 (%) and <a data-link-type="dfn" href="#remaining" id="ref-for-remaining⑨">remaining</a> does not start with two <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-hex-digit" id="ref-for-ascii-hex-digit⑥">ASCII hex digits</a>, <a data-link-type="dfn" href="#validation-error" id="ref-for-validation-error⑥⓪">validation error</a>. </p>
          <li>
           <p><a data-link-type="dfn" href="#utf-8-percent-encode" id="ref-for-utf-8-percent-encode④">UTF-8 percent encode</a> <a data-link-type="dfn" href="#c" id="ref-for-c⑧⑥">c</a> using the <a data-link-type="dfn" href="#fragment-percent-encode-set" id="ref-for-fragment-percent-encode-set①">fragment percent-encode set</a> and append the result to <var>url</var>’s <a data-link-type="dfn" href="#concept-url-fragment" id="ref-for-concept-url-fragment⑦">fragment</a>. </p>
         </ol>
       </dl>
     </dl>
    <li>
     <p>Return <var>url</var>. </p>
   </ol>
   <hr>
   <p>To <dfn class="dfn-paneled" data-dfn-for="url" data-dfn-type="dfn" data-export id="set-the-username">set the username</dfn> given a <var>url</var> and <var>username</var>, run these steps: </p>
   <ol>
    <li>
     <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username①③">username</a> to the empty string. </p>
    <li>
     <p>For each code point in <var>username</var>, <a data-link-type="dfn" href="#utf-8-percent-encode" id="ref-for-utf-8-percent-encode⑤">UTF-8 percent encode</a> it using the <a data-link-type="dfn" href="#userinfo-percent-encode-set" id="ref-for-userinfo-percent-encode-set①">userinfo percent-encode set</a>, and append the result to <var>url</var>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username①④">username</a>. </p>
   </ol>
   <p>To <dfn class="dfn-paneled" data-dfn-for="url" data-dfn-type="dfn" data-export id="set-the-password">set the password</dfn> given a <var>url</var> and <var>password</var>, run these steps: </p>
   <ol>
    <li>
     <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password①③">password</a> to the empty string. </p>
    <li>
     <p>For each code point in <var>password</var>, <a data-link-type="dfn" href="#utf-8-percent-encode" id="ref-for-utf-8-percent-encode⑥">UTF-8 percent encode</a> it using the <a data-link-type="dfn" href="#userinfo-percent-encode-set" id="ref-for-userinfo-percent-encode-set②">userinfo percent-encode set</a>, and append the result to <var>url</var>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password①④">password</a>. </p>
   </ol>
   <h3 class="heading settled" data-level="4.5" id="url-serializing"><span class="secno">4.5. </span><span class="content">URL serializing</span><a class="self-link" href="#url-serializing"></a></h3>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export id="concept-url-serializer">URL serializer</dfn> takes a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url④⓪">URL</a> <var>url</var>, an optional <i title>exclude fragment flag</i>, and
then runs these steps, returning an <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ascii-string" id="ref-for-ascii-string⑨">ASCII string</a>: </p>
   <ol>
    <li>
     <p>Let <var>output</var> be <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme③①">scheme</a> and U+003A (:) concatenated. </p>
    <li>
     <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host③③">host</a> is non-null: </p>
     <ol>
      <li>
       <p>Append "<code>//</code>" to <var>output</var>. </p>
      <li>
       <p>If <var>url</var> <a data-link-type="dfn" href="#include-credentials" id="ref-for-include-credentials②">includes credentials</a>, then: </p>
       <ol>
        <li>
         <p>Append <var>url</var>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username①⑤">username</a> to <var>output</var>. </p>
        <li>
         <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password①⑤">password</a> is not the empty string, then append
     U+003A (:), followed by <var>url</var>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password①⑥">password</a>, to <var>output</var>. </p>
        <li>
         <p>Append U+0040 (@) to <var>output</var>. </p>
       </ol>
      <li>
       <p>Append <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host③④">host</a>, <a data-link-type="dfn" href="#concept-host-serializer" id="ref-for-concept-host-serializer③">serialized</a>, to <var>output</var>. </p>
      <li>
       <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port①⑦">port</a> is non-null, append U+003A (:) followed by <var>url</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port①⑧">port</a>, <a data-link-type="dfn" href="#serialize-an-integer" id="ref-for-serialize-an-integer①">serialized</a>, to <var>output</var>. </p>
     </ol>
    <li>
     <p>Otherwise, if <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host③⑤">host</a> is null and <var>url</var>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme③②">scheme</a> is "<code>file</code>", append
 "<code>//</code>" to <var>output</var>. </p>
    <li>
     <p>If <var>url</var>’s <a data-link-type="dfn" href="#url-cannot-be-a-base-url-flag" id="ref-for-url-cannot-be-a-base-url-flag⑥">cannot-be-a-base-URL flag</a> is set, append <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path③⑤">path</a>[0] to <var>output</var>. </p>
    <li>
     <p>Otherwise, then <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate②">for each</a> string in <var>url</var>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path③⑥">path</a>,
 append U+002F (/) followed by the string to <var>output</var>. </p>
    <li>
     <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query①⑨">query</a> is non-null, append
 U+003F (?), followed by <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query②⓪">query</a>, to <var>output</var>. </p>
    <li>
     <p>If the <i title>exclude fragment flag</i> is unset and <var>url</var>’s <a data-link-type="dfn" href="#concept-url-fragment" id="ref-for-concept-url-fragment⑧">fragment</a> is non-null, append U+0023 (#), followed by <var>url</var>’s <a data-link-type="dfn" href="#concept-url-fragment" id="ref-for-concept-url-fragment⑨">fragment</a>, to <var>output</var>. </p>
    <li>
     <p>Return <var>output</var>. </p>
   </ol>
   <h3 class="heading settled" data-level="4.6" id="url-equivalence"><span class="secno">4.6. </span><span class="content">URL equivalence</span><a class="self-link" href="#url-equivalence"></a></h3>
   <p>To determine whether a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url④①">URL</a> <var>A</var> <dfn class="dfn-paneled" data-dfn-for="url" data-dfn-type="dfn" data-export data-lt="equal" id="concept-url-equals">equals</dfn> <var>B</var>, optionally with an <i>exclude fragments flag</i>, run these steps: </p>
   <ol>
    <li>
     <p>Let <var>serializedA</var> be the result of <a data-link-type="dfn" href="#concept-url-serializer" id="ref-for-concept-url-serializer④">serializing</a> <var>A</var>, with the <i>exclude fragment flag</i> set if the <i>exclude fragments flag</i> is set. </p>
    <li>
     <p>Let <var>serializedB</var> be the result of <a data-link-type="dfn" href="#concept-url-serializer" id="ref-for-concept-url-serializer⑤">serializing</a> <var>B</var>, with the <i>exclude fragment flag</i> set if the <i>exclude fragments flag</i> is set. </p>
    <li>
     <p>Return true if <var>serializedA</var> is <var>serializedB</var>, and false
 otherwise. </p>
   </ol>
   <h3 class="heading settled" data-level="4.7" id="origin"><span class="secno">4.7. </span><span class="content">Origin</span><a class="self-link" href="#origin"></a></h3>
   <p class="note" role="note">See <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin" id="ref-for-concept-origin①">origin</a>’s definition in HTML for the necessary
background information. <a data-link-type="biblio" href="#biblio-html">[HTML]</a> </p>
   <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url④②">URL</a>’s <dfn class="dfn-paneled" data-dfn-for="url" data-dfn-type="dfn" data-export id="concept-url-origin">origin</dfn> is the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin" id="ref-for-concept-origin②">origin</a> returned by running these steps, switching on <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url④③">URL</a>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme③③">scheme</a>: </p>
   <dl class="switch">
    <dt>"<code>blob</code>" 
    <dd>
     <ol>
      <li>
       <p>If <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url④④">URL</a>’s <a data-link-type="dfn" href="#concept-url-blob-entry" id="ref-for-concept-url-blob-entry①">blob URL entry</a> is non-null, then return <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url④⑤">URL</a>’s <a data-link-type="dfn" href="#concept-url-blob-entry" id="ref-for-concept-url-blob-entry②">blob URL entry</a>’s <a data-link-type="dfn" href="https://w3c.github.io/FileAPI/#blob-url-entry-environment" id="ref-for-blob-url-entry-environment">environment</a>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin" id="ref-for-concept-settings-object-origin">origin</a>. </p>
      <li>
       <p>Let <var>url</var> be the result of <a data-link-type="dfn" href="#concept-basic-url-parser" id="ref-for-concept-basic-url-parser③">parsing</a> <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url④⑥">URL</a>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path③⑦">path</a>[0]. </p>
      <li>
       <p>Return a new <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque" id="ref-for-concept-origin-opaque">opaque origin</a>, if <var>url</var> is failure, and <var>url</var>’s <a data-link-type="dfn" href="#concept-url-origin" id="ref-for-concept-url-origin">origin</a> otherwise. </p>
     </ol>
     <p class="example no-backref" id="example-43b5cea5"><a class="self-link" href="#example-43b5cea5"></a>The <a data-link-type="dfn" href="#concept-url-origin" id="ref-for-concept-url-origin①">origin</a> of <code>blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f</code> is the tuple
  (<code>https</code>, <code>whatwg.org</code>, null, null). </p>
    <dt>"<code>ftp</code>" 
    <dt>"<code>http</code>" 
    <dt>"<code>https</code>" 
    <dt>"<code>ws</code>" 
    <dt>"<code>wss</code>" 
    <dd>
     <p>Return a tuple consisting of <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url④⑦">URL</a>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme③④">scheme</a>, <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url④⑧">URL</a>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host③⑥">host</a>, <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url④⑨">URL</a>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port①⑨">port</a>, and null. </p>
    <dt>"<code>file</code>" 
    <dd>
     <p>Unfortunate as it is, this is left as an exercise to the reader. When in doubt,
 return a new <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque" id="ref-for-concept-origin-opaque①">opaque origin</a>. </p>
    <dt>Otherwise 
    <dd>
     <p>Return a new <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque" id="ref-for-concept-origin-opaque②">opaque origin</a>. </p>
     <p class="note no-backref" role="note">This does indeed mean that these <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑤⓪">URLs</a> cannot be <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#same-origin" id="ref-for-same-origin">same-origin</a> with themselves. </p>
   </dl>
   <h3 class="heading settled" data-level="4.8" id="url-rendering"><span class="secno">4.8. </span><span class="content">URL rendering</span><a class="self-link" href="#url-rendering"></a></h3>
   <p>A <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑤①">URL</a> should be rendered in its <a data-link-type="dfn" href="#concept-url-serializer" id="ref-for-concept-url-serializer⑥">serialized</a> form, with
modifications described below, when the primary purpose of displaying a URL is to have the user make
a security or trust decision. For example, users are expected to make trust decisions based on a URL
rendered in the browser address bar. </p>
   <h4 class="heading settled" data-level="4.8.1" id="url-rendering-simplification"><span class="secno">4.8.1. </span><span class="content">Simplify non-human-readable or irrelevant components</span><a class="self-link" href="#url-rendering-simplification"></a></h4>
   <p>Remove components that can provide opportunities for spoofing or distract from security-relevant
information: </p>
   <ul>
    <li>
     <p>Browsers may render only a URL’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host③⑦">host</a> in places where it is important for
 users to distinguish between the host and other parts of the URL such as the <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path③⑧">path</a>. Browsers may consider simplifying the host further to draw attention to its <a data-link-type="dfn" href="#host-registrable-domain" id="ref-for-host-registrable-domain③">registrable domain</a>. For example, browsers may omit a leading <code>www</code> or <code>m</code> domain label to simplify the host, or display its registrable domain only to remove
 spoofing opportunities posted by subdomains (e.g., <code>https://examplecorp.attacker.com/</code>). </p>
    <li>
     <p>Browsers should not render a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑤②">URL</a>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username①⑥">username</a> and <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password①⑦">password</a>, as they can be mistaken for a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑤③">URL</a>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host③⑧">host</a> (e.g., <code>https://examplecorp.com@attacker.example/</code>). </p>
    <li>
     <p>Browsers may render a URL without its <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme③⑤">scheme</a> if the display surface only ever
 permits a single scheme (such as a browser feature that omits <code>https://</code> because it is
 only enabled for secure origins). Otherwise, the scheme may be replaced or supplemented with a
 human-readable string (e.g., "Not secure"), a security indicator icon, or both. </p>
   </ul>
   <h4 class="heading settled" data-level="4.8.2" id="url-rendering-elision"><span class="secno">4.8.2. </span><span class="content">Elision</span><a class="self-link" href="#url-rendering-elision"></a></h4>
   <p>In a space-constrained display, URLs should be elided carefully to avoid misleading the user when
making a security decision: </p>
   <ul>
    <li>
     <p>Browsers should ensure that at least the <a data-link-type="dfn" href="#host-registrable-domain" id="ref-for-host-registrable-domain④">registrable domain</a> can be shown
 when the URL is rendered (to avoid showing, e.g., <code>...examplecorp.com</code> when loading <code>https://not-really-examplecorp.com/</code>). </p>
    <li>
     <p>When the full <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host③⑨">host</a> cannot be rendered, browsers should elide domain labels
 starting from the lowest-level domain label. For example, <code>examplecorp.com.evil.com</code> should be elided as <code>...com.evil.com</code>, not <code>examplecorp.com...</code>. (Note that
 bidirectional text means that the lowest-level label may not appear on the left.) </p>
   </ul>
   <h4 class="heading settled" data-level="4.8.3" id="url-rendering-i18n"><span class="secno">4.8.3. </span><span class="content">Internationalization and special characters</span><a class="self-link" href="#url-rendering-i18n"></a></h4>
   <p>Internationalized domain names (IDNs), special characters, and bidirectional text should be
handled with care to prevent spoofing: </p>
   <ul>
    <li>
     <p>Browsers should render a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑤④">URL</a>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host④⓪">host</a> using <a data-link-type="dfn" href="#concept-domain-to-unicode" id="ref-for-concept-domain-to-unicode">domain to Unicode</a>. </p>
     <p class="note no-backref" role="note">Note that various characters can be used in homograph spoofing attacks.
  Consider detecting confusable characters and warning when they are in use. <a data-link-type="biblio" href="#biblio-idnfaq">[IDNFAQ]</a> <a data-link-type="biblio" href="#biblio-uts39">[UTS39]</a> </p>
    <li>
     <p>URLs are particularly prone to confusion between host and path when they contain
 bidirectional text, so in this case it is particularly advisable to only render a URL’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host④①">host</a>. For readability, other parts of the <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑤⑤">URL</a>, if rendered, should have
 their sequences of <a data-link-type="dfn" href="#percent-encoded-byte" id="ref-for-percent-encoded-byte⑥">percent-encoded bytes</a> replaced with code points resulting from <a data-link-type="dfn" href="#percent-decode" id="ref-for-percent-decode①">percent decoding</a> those sequences converted to bytes, unless that renders those sequences
 invisible. Browsers may choose to not decode certain sequences that present spoofing risks (e.g.,
 U+1F512 (🔒)). </p>
    <li>
     <p>Browsers should render bidirectional text as if it were in a left-to-right embedding. <a data-link-type="biblio" href="#biblio-bidi">[BIDI]</a> </p>
     <p class="note no-backref" role="note">Unfortunately, as rendered <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑤⑥">URLs</a> are strings and can appear
  anywhere, a specific bidirectional algorithm for rendered <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑤⑦">URLs</a> would not see wide
  adoption. Bidirectional text interacts with the parts of a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑤⑧">URL</a> in ways that can cause
  the rendering to be different from the model. Users of bidirectional languages can come to expect
  this, particularly in plain text environments. </p>
   </ul>
   <h2 class="heading settled" data-level="5" id="application/x-www-form-urlencoded"><span class="secno">5. </span><span class="content"><code>application/x-www-form-urlencoded</code></span><a class="self-link" href="#application/x-www-form-urlencoded"></a></h2>
   <p>The <dfn data-dfn-type="dfn" data-export id="concept-urlencoded"><code>application/x-www-form-urlencoded</code><a class="self-link" href="#concept-urlencoded"></a></dfn> format
provides a way to encode name-value pairs. </p>
   <p class="note no-backref" role="note">The <code>application/x-www-form-urlencoded</code> format is in many ways
an aberrant monstrosity, the result of many years of implementation accidents and compromises
leading to a set of requirements necessary for interoperability, but in no way representing good
design practices. In particular, readers are cautioned to pay close attention to the twisted details
involving repeated (and in some cases nested) conversions between character encodings and byte
sequences. Unfortunately the format is in widespread use due to the prevalence of HTML forms. <a data-link-type="biblio" href="#biblio-html">[HTML]</a> </p>
   <h3 class="heading settled" data-level="5.1" id="urlencoded-parsing"><span class="secno">5.1. </span><span class="content"><code>application/x-www-form-urlencoded</code> parsing</span><a class="self-link" href="#urlencoded-parsing"></a></h3>
   <p class="note no-backref" role="note">A legacy server-oriented implementation might have to support <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#encoding" id="ref-for-encoding③">encodings</a> other than <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8" id="ref-for-utf-8⑤">UTF-8</a> as well as have special logic for tuples of which the
name is `<code>_charset</code>`. Such logic is not described here as only <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8" id="ref-for-utf-8⑥">UTF-8</a> is
conforming. </p>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="urlencoded parser" id="concept-urlencoded-parser"><code>application/x-www-form-urlencoded</code> parser</dfn> takes a byte sequence <var>input</var>, and then runs these steps: </p>
   <ol>
    <li>
     <p>Let <var>sequences</var> be the result of splitting <var>input</var> on
 0x26 (&amp;). </p>
    <li>
     <p>Let <var>output</var> be an initially empty <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list" id="ref-for-list②">list</a> of name-value tuples where
 both name and value hold a string. </p>
    <li>
     <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate③">For each</a> byte sequence <var>bytes</var> in <var>sequences</var>: </p>
     <ol>
      <li>
       <p>If <var>bytes</var> is the empty byte sequence, then <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#iteration-continue" id="ref-for-iteration-continue④">continue</a>. </p>
      <li>
       <p>If <var>bytes</var> contains a 0x3D (=), then let <var>name</var> be the bytes from the start of <var>bytes</var> up to but
   excluding its first 0x3D (=), and let <var>value</var> be the
   bytes, if any, after the first 0x3D (=) up to the end of <var>bytes</var>. If 0x3D (=) is the first byte, then <var>name</var> will be the empty byte sequence. If it is the last, then <var>value</var> will be the empty byte sequence. </p>
      <li>
       <p>Otherwise, let <var>name</var> have the value of <var>bytes</var> and let <var>value</var> be the empty byte sequence. </p>
      <li>
       <p>Replace any 0x2B (+) in <var>name</var> and <var>value</var> with 0x20 (SP). </p>
      <li>
       <p>Let <var>nameString</var> and <var>valueString</var> be the result of running <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-decode-without-bom" id="ref-for-utf-8-decode-without-bom③">UTF-8
   decode without BOM</a> on the <a data-link-type="dfn" href="#percent-decode" id="ref-for-percent-decode②">percent decoding</a> of <var>name</var> and <var>value</var>, respectively. </p>
      <li>
       <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-append" id="ref-for-list-append⑤">Append</a> (<var>nameString</var>, <var>valueString</var>) to <var>output</var>. </p>
     </ol>
    <li>
     <p>Return <var>output</var>. </p>
   </ol>
   <h3 class="heading settled" data-level="5.2" id="urlencoded-serializing"><span class="secno">5.2. </span><span class="content"><code>application/x-www-form-urlencoded</code> serializing</span><a class="self-link" href="#urlencoded-serializing"></a></h3>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="urlencoded byte serializer" data-noexport id="concept-urlencoded-byte-serializer"><code>application/x-www-form-urlencoded</code> byte serializer</dfn> takes a byte sequence <var>input</var> and then runs these steps: </p>
   <ol>
    <li>
     <p>Let <var>output</var> be the empty string. </p>
    <li>
     <p>For each byte in <var>input</var>, depending on <var>byte</var>: </p>
     <dl>
      <dt>0x20 (SP) 
      <dd>
       <p>Append U+002B (+) to <var>output</var>. </p>
      <dt>0x2A (*) 
      <dt>0x2D (-) 
      <dt>0x2E (.) 
      <dt>0x30 (0) to 0x39 (9) 
      <dt>0x41 (A) to 0x5A (Z) 
      <dt>0x5F (_) 
      <dt>0x61 (a) to 0x7A (z) 
      <dd>
       <p>Append a code point whose value is <var>byte</var> to <var>output</var>. </p>
      <dt>Otherwise 
      <dd>
       <p>Append <var>byte</var>, <a data-link-type="dfn" href="#percent-encode" id="ref-for-percent-encode②">percent encoded</a>, to <var>output</var>. </p>
     </dl>
    <li>
     <p>Return <var>output</var>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-export data-lt="urlencoded serializer" id="concept-urlencoded-serializer"><code>application/x-www-form-urlencoded</code> serializer</dfn> takes a list of name-value tuples <var>tuples</var>, optionally with an <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#encoding" id="ref-for-encoding④">encoding</a> <var>encoding override</var>, and then runs these steps: </p>
   <ol>
    <li>
     <p>Let <var>encoding</var> be <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8" id="ref-for-utf-8⑦">UTF-8</a>. </p>
    <li>
     <p>If <var>encoding override</var> is given, set <var>encoding</var> to the result of <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#get-an-output-encoding" id="ref-for-get-an-output-encoding①">getting an output encoding</a> from <var>encoding override</var>. </p>
    <li>
     <p>Let <var>output</var> be the empty string. </p>
    <li>
     <p><a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate④">For each</a> <var>tuple</var> in <var>tuples</var>: </p>
     <ol>
      <li>
       <p>Let <var>name</var> be the result of <a data-link-type="dfn" href="#concept-urlencoded-byte-serializer" id="ref-for-concept-urlencoded-byte-serializer">serializing</a> the result of <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#encode" id="ref-for-encode②">encoding</a> <var>tuple</var>’s name, using <var>encoding</var>. </p>
      <li>
       <p>Let <var>value</var> be <var>tuple</var>’s value. </p>
      <li>
       <p>If <var>value</var> is a file, then set <var>value</var> to <var>value</var>’s filename. </p>
      <li>
       <p>Set <var>value</var> to the result of <a data-link-type="dfn" href="#concept-urlencoded-byte-serializer" id="ref-for-concept-urlencoded-byte-serializer①">serializing</a> the result of <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#encode" id="ref-for-encode③">encoding</a> <var>value</var>, using <var>encoding</var>. </p>
      <li>
       <p>If <var>tuple</var> is not the first pair in <var>tuples</var>, then append
   U+0026 (&amp;) to <var>output</var>. </p>
      <li>Append <var>name</var>, followed by U+003D (=), followed by <var>value</var>, to <var>output</var>. 
     </ol>
    <li>Return <var>output</var>. 
   </ol>
   <p class="note no-backref" role="note">The <cite>HTML standard</cite> invokes this algorithm with values that
are files. <a data-link-type="biblio" href="#biblio-html">[HTML]</a> </p>
   <h3 class="heading settled" data-level="5.3" id="urlencoded-hooks"><span class="secno">5.3. </span><span class="content">Hooks</span><a class="self-link" href="#urlencoded-hooks"></a></h3>
   <p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="urlencoded string parser" data-noexport id="concept-urlencoded-string-parser"><code>application/x-www-form-urlencoded</code> string parser</dfn> takes a string <var>input</var>, <a data-link-type="dfn" href="https://encoding.spec.whatwg.org/#utf-8-encode" id="ref-for-utf-8-encode②">UTF-8 encodes</a> it, and then returns the result of <a data-link-type="dfn" href="#concept-urlencoded-parser" id="ref-for-concept-urlencoded-parser"><code>application/x-www-form-urlencoded</code> parsing</a> it. </p>
   <h2 class="heading settled" data-level="6" id="api"><span class="secno">6. </span><span class="content">API</span><a class="self-link" href="#api"></a></h2>
   <h3 class="heading settled" data-level="6.1" id="url-class"><span class="secno">6.1. </span><span class="content">URL class</span><a class="self-link" href="#url-class"></a></h3>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>Worker</c->),
 <a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#LegacyWindowAlias" id="ref-for-LegacyWindowAlias"><c- g>LegacyWindowAlias</c-></a>=<dfn class="idl-code" data-dfn-type="interface" data-export id="webkiturl"><code><c- n>webkitURL</c-></code><a class="self-link" href="#webkiturl"></a></dfn>]
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="url"><code><c- g>URL</c-></code></dfn> {
  <a class="idl-code" data-link-type="constructor" href="#dom-url-url" id="ref-for-dom-url-url"><c- g>constructor</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString"><c- b>USVString</c-></a> <dfn class="idl-code" data-dfn-for="URL/URL(url, base), URL/constructor(url, base), URL/URL(url), URL/constructor(url)" data-dfn-type="argument" data-export id="dom-url-url-url-base-url"><code><c- g>url</c-></code><a class="self-link" href="#dom-url-url-url-base-url"></a></dfn>, <c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①"><c- b>USVString</c-></a> <dfn class="idl-code" data-dfn-for="URL/URL(url, base), URL/constructor(url, base), URL/URL(url), URL/constructor(url)" data-dfn-type="argument" data-export id="dom-url-url-url-base-base"><code><c- g>base</c-></code><a class="self-link" href="#dom-url-url-url-base-base"></a></dfn>);

  <dfn data-dfn-for="URL" data-dfn-type="dfn" data-export data-lt="stringification behavior" id="URL-stringification-behavior"><c- b>stringifier</c-><a class="self-link" href="#URL-stringification-behavior"></a></dfn> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-href" id="ref-for-dom-url-href"><c- g>href</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString③"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="USVString" href="#dom-url-origin" id="ref-for-dom-url-origin"><c- g>origin</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString④"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-protocol" id="ref-for-dom-url-protocol"><c- g>protocol</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString⑤"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-username" id="ref-for-dom-url-username"><c- g>username</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString⑥"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-password" id="ref-for-dom-url-password"><c- g>password</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString⑦"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-host" id="ref-for-dom-url-host"><c- g>host</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString⑧"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-hostname" id="ref-for-dom-url-hostname"><c- g>hostname</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString⑨"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-port" id="ref-for-dom-url-port"><c- g>port</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①⓪"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-pathname" id="ref-for-dom-url-pathname"><c- g>pathname</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①①"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-search" id="ref-for-dom-url-search"><c- g>search</c-></a>;
  [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#SameObject" id="ref-for-SameObject"><c- g>SameObject</c-></a>] <c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="#urlsearchparams" id="ref-for-urlsearchparams"><c- n>URLSearchParams</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="URLSearchParams" href="#dom-url-searchparams" id="ref-for-dom-url-searchparams"><c- g>searchParams</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①②"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-hash" id="ref-for-dom-url-hash"><c- g>hash</c-></a>;

  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①③"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="method" href="#dom-url-tojson" id="ref-for-dom-url-tojson"><c- g>toJSON</c-></a>();
};
</pre>
   <p>A <code class="idl"><a data-link-type="idl" href="#url" id="ref-for-url①">URL</a></code> object has an associated <dfn class="dfn-paneled" data-dfn-for="URL" data-dfn-type="dfn" data-noexport id="concept-url-url">url</dfn> (a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑤⑨">URL</a>) and <dfn class="dfn-paneled" data-dfn-for="URL" data-dfn-type="dfn" data-noexport id="concept-url-query-object">query object</dfn> (a <code class="idl"><a data-link-type="idl" href="#urlsearchparams" id="ref-for-urlsearchparams①">URLSearchParams</a></code> object). </p>
   <hr>
   <p id="constructors">The <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="constructor" data-export data-lt="URL(url, base)|constructor(url, base)|URL(url)|constructor(url)" id="dom-url-url"><code>URL(<var>url</var>, <var>base</var>)</code></dfn> constructor, when invoked, must run these steps: </p>
   <ol>
    <li>
     <p>Let <var>parsedBase</var> be null. </p>
    <li>
     <p>If <var>base</var> is given, then: </p>
     <ol>
      <li>
       <p>Let <var>parsedBase</var> be the result of running the <a data-link-type="dfn" href="#concept-basic-url-parser" id="ref-for-concept-basic-url-parser④">basic URL parser</a> on <var>base</var>. </p>
      <li>
       <p>If <var>parsedBase</var> is failure, then <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-throw" id="ref-for-dfn-throw">throw</a> a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror">TypeError</a></code>. </p>
     </ol>
    <li>
     <p>Let <var>parsedURL</var> be the result of running the <a data-link-type="dfn" href="#concept-basic-url-parser" id="ref-for-concept-basic-url-parser⑤">basic URL parser</a> on <var>url</var> with <var>parsedBase</var>. </p>
    <li>
     <p>If <var>parsedURL</var> is failure, then <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-throw" id="ref-for-dfn-throw①">throw</a> a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror①">TypeError</a></code>. </p>
    <li>
     <p>Let <var>query</var> be <var>parsedURL</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query②①">query</a>, if that is non-null,
 and the empty string otherwise. </p>
    <li>
     <p>Let <var>result</var> be a new <code class="idl"><a data-link-type="idl" href="#url" id="ref-for-url②">URL</a></code> object. </p>
    <li>
     <p>Set <var>result</var>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url">url</a> to <var>parsedURL</var>. </p>
    <li>
     <p>Set <var>result</var>’s <a data-link-type="dfn" href="#concept-url-query-object" id="ref-for-concept-url-query-object">query object</a> to a <a data-link-type="dfn" href="#concept-urlsearchparams-new" id="ref-for-concept-urlsearchparams-new">new</a> <code class="idl"><a data-link-type="idl" href="#urlsearchparams" id="ref-for-urlsearchparams②">URLSearchParams</a></code> object using <var>query</var>, and then set that <a data-link-type="dfn" href="#concept-url-query-object" id="ref-for-concept-url-query-object①">query object</a>’s <a data-link-type="dfn" href="#concept-urlsearchparams-url-object" id="ref-for-concept-urlsearchparams-url-object">url object</a> to <var>result</var>. </p>
    <li>
     <p>Return <var>result</var>. </p>
   </ol>
   <div class="example no-backref" id="example-5434421b">
    <a class="self-link" href="#example-5434421b"></a> 
    <p>To <a data-link-type="dfn" href="#concept-basic-url-parser" id="ref-for-concept-basic-url-parser⑥">parse</a> a string into a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑥⓪">URL</a> without using a <a data-link-type="dfn" href="#concept-base-url" id="ref-for-concept-base-url⑦">base URL</a>, invoke the <code class="idl"><a data-link-type="idl" href="#url" id="ref-for-url③">URL</a></code> constructor with a single argument: </p>
<pre><code class="lang-javascript highlight"><c- a>var</c-> input <c- o>=</c-> <c- u>"https://example.org/💩"</c-><c- p>,</c->
    url <c- o>=</c-> <c- k>new</c-> URL<c- p>(</c->input<c- p>)</c->
url<c- p>.</c->pathname <c- c1>// "/%F0%9F%92%A9"</c-></code></pre>
    <p>This throws an exception if the input is not an <a data-link-type="dfn" href="#absolute-url-with-fragment-string" id="ref-for-absolute-url-with-fragment-string①">absolute-URL-with-fragment string</a>: </p>
<pre><code class="lang-javascript highlight"><c- k>try</c-> <c- p>{</c->
  <c- a>var</c-> url <c- o>=</c-> <c- k>new</c-> URL<c- p>(</c-><c- u>"/🍣🍺"</c-><c- p>)</c->
<c- p>}</c-> <c- k>catch</c-><c- p>(</c->e<c- p>)</c-> <c- p>{</c->
  <c- c1>// that happened</c->
<c- p>}</c-></code></pre>
    <p>A <a data-link-type="dfn" href="#concept-base-url" id="ref-for-concept-base-url⑧">base URL</a> is necessary if the input is a <a data-link-type="dfn" href="#relative-url-string" id="ref-for-relative-url-string④">relative-URL string</a>: </p>
<pre><code class="lang-javascript highlight"><c- a>var</c-> input <c- o>=</c-> <c- u>"/🍣🍺"</c-><c- p>,</c->
    url <c- o>=</c-> <c- k>new</c-> URL<c- p>(</c->input<c- p>,</c-> document<c- p>.</c->baseURI<c- p>)</c->
url<c- p>.</c->href <c- c1>// "https://url.spec.whatwg.org/%F0%9F%8D%A3%F0%9F%8D%BA"</c-></code></pre>
    <p>A <code class="idl"><a data-link-type="idl" href="#url" id="ref-for-url④">URL</a></code> object can be used as <a data-link-type="dfn" href="#concept-base-url" id="ref-for-concept-base-url⑨">base URL</a> (while IDL requires a string as argument, a <code class="idl"><a data-link-type="idl" href="#url" id="ref-for-url⑤">URL</a></code> object stringifies to its <code class="idl"><a data-link-type="idl" href="#dom-url-href" id="ref-for-dom-url-href①">href</a></code> attribute value):</p>
<pre><code class="lang-javascript highlight"><c- a>var</c-> url <c- o>=</c-> <c- k>new</c-> URL<c- p>(</c-><c- u>"🏳️‍🌈"</c-><c- p>,</c-> <c- k>new</c-> URL<c- p>(</c-><c- u>"https://pride.example/hello-world"</c-><c- p>))</c->
url<c- p>.</c->pathname <c- c1>// "/%F0%9F%8F%B3%EF%B8%8F%E2%80%8D%F0%9F%8C%88"</c-></code></pre>
   </div>
   <hr id="urlutils-members">
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="attribute" data-export id="dom-url-href"><code>href</code></dfn> attribute’s getter and the <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="method" data-export id="dom-url-tojson"><code>toJSON()</code></dfn> method, when invoked, must return the <a data-link-type="dfn" href="#concept-url-serializer" id="ref-for-concept-url-serializer⑦">serialization</a> of <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url①">url</a>. </p>
   <p>The <code><a class="idl-code" data-link-type="attribute" href="#dom-url-href" id="ref-for-dom-url-href②">href</a></code> attribute’s setter must run these steps: </p>
   <ol>
    <li>
     <p>Let <var>parsedURL</var> be the result of running the <a data-link-type="dfn" href="#concept-basic-url-parser" id="ref-for-concept-basic-url-parser⑦">basic URL parser</a> on the given
 value. </p>
    <li>
     <p>If <var>parsedURL</var> is failure, then <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-throw" id="ref-for-dfn-throw②">throw</a> a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror②">TypeError</a></code>. </p>
    <li>
     <p>Set <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url②">url</a> to <var>parsedURL</var>. </p>
    <li>
     <p>Empty <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object②">context object</a>’s <a data-link-type="dfn" href="#concept-url-query-object" id="ref-for-concept-url-query-object②">query object</a>’s <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list">list</a>. </p>
    <li>
     <p>Let <var>query</var> be <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object③">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url③">url</a>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query②②">query</a>. </p>
    <li>
     <p>If <var>query</var> is non-null, then set <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object④">context object</a>’s <a data-link-type="dfn" href="#concept-url-query-object" id="ref-for-concept-url-query-object③">query object</a>’s <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list①">list</a> to the result of <a data-link-type="dfn" href="#concept-urlencoded-string-parser" id="ref-for-concept-urlencoded-string-parser">parsing</a> <var>query</var>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="attribute" data-export id="dom-url-origin"><code>origin</code></dfn> attribute’s getter must return the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/origin.html#ascii-serialisation-of-an-origin" id="ref-for-ascii-serialisation-of-an-origin">serialization</a> of <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object⑤">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url④">url</a>’s <a data-link-type="dfn" href="#concept-url-origin" id="ref-for-concept-url-origin②">origin</a>. <a data-link-type="biblio" href="#biblio-html">[HTML]</a> </p>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="attribute" data-export id="dom-url-protocol"><code>protocol</code></dfn> attribute’s getter must return <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object⑥">context object</a> <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url⑤">url</a>’s <a data-link-type="dfn" href="#concept-url-scheme" id="ref-for-concept-url-scheme③⑥">scheme</a>, followed by U+003A (:). </p>
   <p>The <code><a class="idl-code" data-link-type="attribute" href="#dom-url-protocol" id="ref-for-dom-url-protocol①">protocol</a></code> attribute’s setter must <a data-link-type="dfn" href="#concept-basic-url-parser" id="ref-for-concept-basic-url-parser⑧">basic URL parse</a> the given value, followed by U+003A (:), with <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object⑦">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url⑥">url</a> as <var>url</var> and <a data-link-type="dfn" href="#scheme-start-state" id="ref-for-scheme-start-state①">scheme start state</a> as <var>state override</var>. </p>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="attribute" data-export id="dom-url-username"><code>username</code></dfn> attribute’s getter must return <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object⑧">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url⑦">url</a>’s <a data-link-type="dfn" href="#concept-url-username" id="ref-for-concept-url-username①⑦">username</a>. </p>
   <p>The <code><a class="idl-code" data-link-type="attribute" href="#dom-url-username" id="ref-for-dom-url-username①">username</a></code> attribute’s setter must run these steps: </p>
   <ol>
    <li>
     <p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object⑨">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url⑧">url</a> <a data-link-type="dfn" href="#cannot-have-a-username-password-port" id="ref-for-cannot-have-a-username-password-port">cannot have a username/password/port</a>,
 then return. </p>
    <li>
     <p><a data-link-type="dfn" href="#set-the-username" id="ref-for-set-the-username">Set the username</a> given <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①⓪">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url⑨">url</a> and the
 given value. </p>
   </ol>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="attribute" data-export id="dom-url-password"><code>password</code></dfn> attribute’s getter must return <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①①">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url①⓪">url</a>’s <a data-link-type="dfn" href="#concept-url-password" id="ref-for-concept-url-password①⑧">password</a>. </p>
   <p>The <code><a class="idl-code" data-link-type="attribute" href="#dom-url-password" id="ref-for-dom-url-password①">password</a></code> attribute’s setter must run these steps: </p>
   <ol>
    <li>
     <p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①②">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url①①">url</a> <a data-link-type="dfn" href="#cannot-have-a-username-password-port" id="ref-for-cannot-have-a-username-password-port①">cannot have a username/password/port</a>,
 then return. </p>
    <li>
     <p><a data-link-type="dfn" href="#set-the-password" id="ref-for-set-the-password">Set the password</a> given <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①③">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url①②">url</a> and the
 given value. </p>
   </ol>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="attribute" data-export id="dom-url-host"><code>host</code></dfn> attribute’s getter must run these steps: </p>
   <ol>
    <li>
     <p>Let <var>url</var> be <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①④">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url①③">url</a>. </p>
    <li>
     <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host④②">host</a> is null, return the empty string. </p>
    <li>
     <p>If <var>url</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port②⓪">port</a> is null, return <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host④③">host</a>, <a data-link-type="dfn" href="#concept-host-serializer" id="ref-for-concept-host-serializer④">serialized</a>. </p>
    <li>
     <p>Return <var>url</var>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host④④">host</a>, <a data-link-type="dfn" href="#concept-host-serializer" id="ref-for-concept-host-serializer⑤">serialized</a>,
 followed by U+003A (:) and <var>url</var>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port②①">port</a>, <a data-link-type="dfn" href="#serialize-an-integer" id="ref-for-serialize-an-integer②">serialized</a>. </p>
   </ol>
   <p>The <code><a class="idl-code" data-link-type="attribute" href="#dom-url-host" id="ref-for-dom-url-host①">host</a></code> attribute’s setter must run these steps: </p>
   <ol>
    <li>
     <p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①⑤">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url①④">url</a>’s <a data-link-type="dfn" href="#url-cannot-be-a-base-url-flag" id="ref-for-url-cannot-be-a-base-url-flag⑦">cannot-be-a-base-URL flag</a> is
 set, then return. </p>
    <li>
     <p><a data-link-type="dfn" href="#concept-basic-url-parser" id="ref-for-concept-basic-url-parser⑨">Basic URL parse</a> the given value with <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①⑥">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url①⑤">url</a> as <var>url</var> and <a data-link-type="dfn" href="#host-state" id="ref-for-host-state①">host state</a> as <var>state override</var>. </p>
   </ol>
   <p class="note no-backref" role="note">If the given value for the <code><a class="idl-code" data-link-type="attribute" href="#dom-url-host" id="ref-for-dom-url-host②">host</a></code> attribute’s setter lacks a <a data-link-type="dfn" href="#url-port-string" id="ref-for-url-port-string②">port</a>, <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①⑦">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url①⑥">url</a>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port②②">port</a> will not change. This can be unexpected as <code>host</code> attribute’s getter does return a <a data-link-type="dfn" href="#url-port-string" id="ref-for-url-port-string③">URL-port string</a> so one might have assumed
the setter to always "reset" both. </p>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="attribute" data-export id="dom-url-hostname"><code>hostname</code></dfn> attribute’s getter must run these steps: </p>
   <ol>
    <li>
     <p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①⑧">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url①⑦">url</a>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host④⑤">host</a> is null, return the
 empty string. </p>
    <li>
     <p>Return <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object①⑨">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url①⑧">url</a>’s <a data-link-type="dfn" href="#concept-url-host" id="ref-for-concept-url-host④⑥">host</a>, <a data-link-type="dfn" href="#concept-host-serializer" id="ref-for-concept-host-serializer⑥">serialized</a>. </p>
   </ol>
   <p>The <code><a class="idl-code" data-link-type="attribute" href="#dom-url-hostname" id="ref-for-dom-url-hostname①">hostname</a></code> attribute’s setter must run these steps: </p>
   <ol>
    <li>
     <p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object②⓪">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url①⑨">url</a>’s <a data-link-type="dfn" href="#url-cannot-be-a-base-url-flag" id="ref-for-url-cannot-be-a-base-url-flag⑧">cannot-be-a-base-URL flag</a> is
 set, then return. </p>
    <li>
     <p><a data-link-type="dfn" href="#concept-basic-url-parser" id="ref-for-concept-basic-url-parser①⓪">Basic URL parse</a> the given value with <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object②①">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url②⓪">url</a> as <var>url</var> and <a data-link-type="dfn" href="#hostname-state" id="ref-for-hostname-state①">hostname state</a> as <var>state override</var>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="attribute" data-export id="dom-url-port"><code>port</code></dfn> attribute’s getter must run these steps: </p>
   <ol>
    <li>
     <p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object②②">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url②①">url</a>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port②③">port</a> is null, return the
 empty string. </p>
    <li>
     <p>Return <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object②③">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url②②">url</a>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port②④">port</a>, <a data-link-type="dfn" href="#serialize-an-integer" id="ref-for-serialize-an-integer③">serialized</a>. </p>
   </ol>
   <p>The <code><a class="idl-code" data-link-type="attribute" href="#dom-url-port" id="ref-for-dom-url-port①">port</a></code> attribute’s setter must run these steps: </p>
   <ol>
    <li>
     <p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object②④">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url②③">url</a> <a data-link-type="dfn" href="#cannot-have-a-username-password-port" id="ref-for-cannot-have-a-username-password-port②">cannot have a username/password/port</a>,
 then return. </p>
    <li>
     <p>If the given value is the empty string, then set <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object②⑤">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url②④">url</a>’s <a data-link-type="dfn" href="#concept-url-port" id="ref-for-concept-url-port②⑤">port</a> to null.</p>
    <li>
     <p>Otherwise, <a data-link-type="dfn" href="#concept-basic-url-parser" id="ref-for-concept-basic-url-parser①①">basic URL parse</a> the given value with <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object②⑥">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url②⑤">url</a> as <var>url</var> and <a data-link-type="dfn" href="#port-state" id="ref-for-port-state①">port state</a> as <var>state override</var>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="attribute" data-export id="dom-url-pathname"><code>pathname</code></dfn> attribute’s getter must run these steps: </p>
   <ol>
    <li>
     <p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object②⑦">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url②⑥">url</a>’s <a data-link-type="dfn" href="#url-cannot-be-a-base-url-flag" id="ref-for-url-cannot-be-a-base-url-flag⑨">cannot-be-a-base-URL flag</a> is
 set, then return <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object②⑧">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url②⑦">url</a>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path③⑨">path</a>[0]. </p>
    <li>
     <p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object②⑨">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url②⑧">url</a>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path④⓪">path</a> <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-is-empty" id="ref-for-list-is-empty③">is empty</a>, then return the empty string. </p>
    <li>
     <p>Return U+002F (/), followed by the strings in <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object③⓪">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url②⑨">url</a>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path④①">path</a> (including empty strings), if any, separated from each
 other by U+002F (/). </p>
   </ol>
   <p>The <code><a class="idl-code" data-link-type="attribute" href="#dom-url-pathname" id="ref-for-dom-url-pathname①">pathname</a></code> attribute’s setter must
run these steps: </p>
   <ol>
    <li>
     <p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object③①">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url③⓪">url</a>’s <a data-link-type="dfn" href="#url-cannot-be-a-base-url-flag" id="ref-for-url-cannot-be-a-base-url-flag①⓪">cannot-be-a-base-URL flag</a> is
 set, then return. </p>
    <li>
     <p>Empty <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object③②">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url③①">url</a>’s <a data-link-type="dfn" href="#concept-url-path" id="ref-for-concept-url-path④②">path</a>. </p>
    <li>
     <p><a data-link-type="dfn" href="#concept-basic-url-parser" id="ref-for-concept-basic-url-parser①②">Basic URL parse</a> the given value with <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object③③">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url③②">url</a> as <var>url</var> and <a data-link-type="dfn" href="#path-start-state" id="ref-for-path-start-state④">path start state</a> as <var>state override</var>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="attribute" data-export id="dom-url-search"><code>search</code></dfn> attribute’s getter must run these steps: </p>
   <ol>
    <li>
     <p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object③④">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url③③">url</a>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query②③">query</a> is either null or the
 empty string, return the empty string. </p>
    <li>
     <p>Return U+003F (?), followed by <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object③⑤">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url③④">url</a>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query②④">query</a>. </p>
   </ol>
   <p>The <code><a class="idl-code" data-link-type="attribute" href="#dom-url-search" id="ref-for-dom-url-search①">search</a></code> attribute’s setter must run these
steps: </p>
   <ol>
    <li>
     <p>Let <var>url</var> be <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object③⑥">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url③⑤">url</a>. </p>
    <li>
     <p>If the given value is the empty string, set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query②⑤">query</a> to null,
 empty <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object③⑦">context object</a>’s <a data-link-type="dfn" href="#concept-url-query-object" id="ref-for-concept-url-query-object④">query object</a>’s <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list②">list</a>,
 and then return. </p>
    <li>
     <p>Let <var>input</var> be the given value with a single leading U+003F (?) removed, if
 any. </p>
    <li>
     <p>Set <var>url</var>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query②⑥">query</a> to the empty string. </p>
    <li>
     <p><a data-link-type="dfn" href="#concept-basic-url-parser" id="ref-for-concept-basic-url-parser①③">Basic URL parse</a> <var>input</var> with <var>url</var> as <var>url</var> and <a data-link-type="dfn" href="#query-state" id="ref-for-query-state⑤">query state</a> as <var>state override</var>. </p>
    <li>
     <p>Set <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object③⑧">context object</a>’s <a data-link-type="dfn" href="#concept-url-query-object" id="ref-for-concept-url-query-object⑤">query object</a>’s <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list③">list</a> to
 the result of <a data-link-type="dfn" href="#concept-urlencoded-string-parser" id="ref-for-concept-urlencoded-string-parser①">parsing</a> <var>input</var>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="attribute" data-export id="dom-url-searchparams"><code>searchParams</code></dfn> attribute’s getter must return <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object③⑨">context object</a>’s <a data-link-type="dfn" href="#concept-url-query-object" id="ref-for-concept-url-query-object⑥">query object</a>. </p>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URL" data-dfn-type="attribute" data-export id="dom-url-hash"><code>hash</code></dfn> attribute’s
getter must run these steps: </p>
   <ol>
    <li>
     <p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object④⓪">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url③⑥">url</a>’s <a data-link-type="dfn" href="#concept-url-fragment" id="ref-for-concept-url-fragment①⓪">fragment</a> is either null or
 the empty string, return the empty string. </p>
    <li>
     <p>Return U+0023 (#), followed by <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object④①">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url③⑦">url</a>’s <a data-link-type="dfn" href="#concept-url-fragment" id="ref-for-concept-url-fragment①①">fragment</a>. </p>
   </ol>
   <p>The <code><a class="idl-code" data-link-type="attribute" href="#dom-url-hash" id="ref-for-dom-url-hash①">hash</a></code> attribute’s setter must run these
steps: </p>
   <ol>
    <li>
     <p>If the given value is the empty string, then set <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object④②">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url③⑧">url</a>’s <a data-link-type="dfn" href="#concept-url-fragment" id="ref-for-concept-url-fragment①②">fragment</a> to null and return. </p>
    <li>
     <p>Let <var>input</var> be the given value with a single leading U+0023 (#) removed, if
 any. </p>
    <li>
     <p>Set <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object④③">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url③⑨">url</a>’s <a data-link-type="dfn" href="#concept-url-fragment" id="ref-for-concept-url-fragment①③">fragment</a> to the empty
 string. </p>
    <li>
     <p><a data-link-type="dfn" href="#concept-basic-url-parser" id="ref-for-concept-basic-url-parser①④">Basic URL parse</a> <var>input</var> with <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object" id="ref-for-context-object④④">context object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url④⓪">url</a> as <var>url</var> and <a data-link-type="dfn" href="#fragment-state" id="ref-for-fragment-state⑦">fragment state</a> as <var>state override</var>. </p>
   </ol>
   <h3 class="heading settled" data-level="6.2" id="interface-urlsearchparams"><span class="secno">6.2. </span><span class="content">URLSearchParams class</span><a class="self-link" href="#interface-urlsearchparams"></a></h3>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed①"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>Worker</c->)]
<c- b>interface</c-> <dfn class="dfn-paneled idl-code" data-dfn-type="interface" data-export id="urlsearchparams"><code><c- g>URLSearchParams</c-></code></dfn> {
  <a class="idl-code" data-link-type="constructor" href="#dom-urlsearchparams-urlsearchparams" id="ref-for-dom-urlsearchparams-urlsearchparams"><c- g>constructor</c-></a>(<c- b>optional</c-> (<c- b>sequence</c->&lt;<c- b>sequence</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①④"><c- b>USVString</c-></a>>> <c- b>or</c-> <c- b>record</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①⑤"><c- b>USVString</c-></a>, <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①⑥"><c- b>USVString</c-></a>> <c- b>or</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①⑦"><c- b>USVString</c-></a>) <dfn class="idl-code" data-dfn-for="URLSearchParams/URLSearchParams(init), URLSearchParams/constructor(init), URLSearchParams/URLSearchParams(), URLSearchParams/constructor()" data-dfn-type="argument" data-export id="dom-urlsearchparams-urlsearchparams-init-init"><code><c- g>init</c-></code><a class="self-link" href="#dom-urlsearchparams-urlsearchparams-init-init"></a></dfn> = "");

  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dom-urlsearchparams-append" id="ref-for-dom-urlsearchparams-append"><c- g>append</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①⑧"><c- b>USVString</c-></a> <dfn class="idl-code" data-dfn-for="URLSearchParams/append(name, value)" data-dfn-type="argument" data-export id="dom-urlsearchparams-append-name-value-name"><code><c- g>name</c-></code><a class="self-link" href="#dom-urlsearchparams-append-name-value-name"></a></dfn>, <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①⑨"><c- b>USVString</c-></a> <dfn class="idl-code" data-dfn-for="URLSearchParams/append(name, value)" data-dfn-type="argument" data-export id="dom-urlsearchparams-append-name-value-value"><code><c- g>value</c-></code><a class="self-link" href="#dom-urlsearchparams-append-name-value-value"></a></dfn>);
  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dom-urlsearchparams-delete" id="ref-for-dom-urlsearchparams-delete"><c- g>delete</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②⓪"><c- b>USVString</c-></a> <dfn class="idl-code" data-dfn-for="URLSearchParams/delete(name)" data-dfn-type="argument" data-export id="dom-urlsearchparams-delete-name-name"><code><c- g>name</c-></code><a class="self-link" href="#dom-urlsearchparams-delete-name-name"></a></dfn>);
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②①"><c- b>USVString</c-></a>? <a class="idl-code" data-link-type="method" href="#dom-urlsearchparams-get" id="ref-for-dom-urlsearchparams-get"><c- g>get</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②②"><c- b>USVString</c-></a> <dfn class="idl-code" data-dfn-for="URLSearchParams/get(name)" data-dfn-type="argument" data-export id="dom-urlsearchparams-get-name-name"><code><c- g>name</c-></code><a class="self-link" href="#dom-urlsearchparams-get-name-name"></a></dfn>);
  <c- b>sequence</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②③"><c- b>USVString</c-></a>> <a class="idl-code" data-link-type="method" href="#dom-urlsearchparams-getall" id="ref-for-dom-urlsearchparams-getall"><c- g>getAll</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②④"><c- b>USVString</c-></a> <dfn class="idl-code" data-dfn-for="URLSearchParams/getAll(name)" data-dfn-type="argument" data-export id="dom-urlsearchparams-getall-name-name"><code><c- g>name</c-></code><a class="self-link" href="#dom-urlsearchparams-getall-name-name"></a></dfn>);
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean"><c- b>boolean</c-></a> <a class="idl-code" data-link-type="method" href="#dom-urlsearchparams-has" id="ref-for-dom-urlsearchparams-has"><c- g>has</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②⑤"><c- b>USVString</c-></a> <dfn class="idl-code" data-dfn-for="URLSearchParams/has(name)" data-dfn-type="argument" data-export id="dom-urlsearchparams-has-name-name"><code><c- g>name</c-></code><a class="self-link" href="#dom-urlsearchparams-has-name-name"></a></dfn>);
  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dom-urlsearchparams-set" id="ref-for-dom-urlsearchparams-set"><c- g>set</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②⑥"><c- b>USVString</c-></a> <dfn class="idl-code" data-dfn-for="URLSearchParams/set(name, value)" data-dfn-type="argument" data-export id="dom-urlsearchparams-set-name-value-name"><code><c- g>name</c-></code><a class="self-link" href="#dom-urlsearchparams-set-name-value-name"></a></dfn>, <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②⑦"><c- b>USVString</c-></a> <dfn class="idl-code" data-dfn-for="URLSearchParams/set(name, value)" data-dfn-type="argument" data-export id="dom-urlsearchparams-set-name-value-value"><code><c- g>value</c-></code><a class="self-link" href="#dom-urlsearchparams-set-name-value-value"></a></dfn>);

  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dom-urlsearchparams-sort" id="ref-for-dom-urlsearchparams-sort"><c- g>sort</c-></a>();

  <c- b>iterable</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②⑧"><c- b>USVString</c-></a>, <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②⑨"><c- b>USVString</c-></a>>;
  <a data-link-type="dfn" href="#urlsearchparams-stringification-behavior" id="ref-for-urlsearchparams-stringification-behavior"><c- b>stringifier</c-></a>;
};
</pre>
   <div class="example" id="example-constructing-urlsearchparams">
    <a class="self-link" href="#example-constructing-urlsearchparams"></a> 
    <p>Constructing and stringifying a <code class="idl"><a data-link-type="idl" href="#urlsearchparams" id="ref-for-urlsearchparams③">URLSearchParams</a></code> object is fairly straightforward: </p>
<pre><code class="lang-javascript highlight"><c- a>let</c-> params <c- o>=</c-> <c- k>new</c-> URLSearchParams<c- p>({</c->key<c- o>:</c-> <c- u>"730d67"</c-><c- p>})</c->
params<c- p>.</c->toString<c- p>()</c-> <c- c1>// "key=730d67"</c-></code></pre>
   </div>
   <p>A <code class="idl"><a data-link-type="idl" href="#urlsearchparams" id="ref-for-urlsearchparams④">URLSearchParams</a></code> object has an associated <dfn class="dfn-paneled" data-dfn-for="URLSearchParams" data-dfn-type="dfn" data-export id="concept-urlsearchparams-list">list</dfn> of name-value pairs,
which is initially empty. </p>
   <p>A <code class="idl"><a data-link-type="idl" href="#urlsearchparams" id="ref-for-urlsearchparams⑤">URLSearchParams</a></code> object has an associated <dfn class="dfn-paneled" data-dfn-for="URLSearchParams" data-dfn-type="dfn" data-export id="concept-urlsearchparams-url-object">url object</dfn>, which is
initially null. </p>
   <p>To create a <dfn class="dfn-paneled" data-dfn-for="URLSearchParams" data-dfn-type="dfn" data-export id="concept-urlsearchparams-new">new</dfn> <code class="idl"><a data-link-type="idl" href="#urlsearchparams" id="ref-for-urlsearchparams⑥">URLSearchParams</a></code> object using <var>init</var>, run these steps: </p>
   <ol>
    <li>
     <p>Let <var>query</var> be a new <code class="idl"><a data-link-type="idl" href="#urlsearchparams" id="ref-for-urlsearchparams⑦">URLSearchParams</a></code> object. </p>
    <li>
     <p>If <var>init</var> is a <a data-link-type="dfn" href="https://heycam.github.io/webidl/#idl-sequence" id="ref-for-idl-sequence">sequence</a>, then <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#list-iterate" id="ref-for-list-iterate⑤">for each</a> <var>pair</var> in <var>init</var>: </p>
     <ol>
      <li>
       <p>If <var>pair</var> does not contain exactly two items, then <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-throw" id="ref-for-dfn-throw③">throw</a> a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#exceptiondef-typeerror" id="ref-for-exceptiondef-typeerror③">TypeError</a></code>. </p>
      <li>
       <p>Append a new name-value pair whose name is <var>pair</var>’s first item, and value is <var>pair</var>’s second item, to <var>query</var>’s <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list④">list</a>. </p>
     </ol>
    <li>
     <p>Otherwise, if <var>init</var> is a <a data-link-type="dfn" href="https://heycam.github.io/webidl/#idl-record" id="ref-for-idl-record">record</a>, then <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#map-iterate" id="ref-for-map-iterate">for each</a> <var>name</var> → <var>value</var> in <var>init</var>, append a new name-value pair whose name is <var>name</var> and value is <var>value</var>, to <var>query</var>’s <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list⑤">list</a>. </p>
    <li>
     <p>Otherwise, <var>init</var> is a string, then set <var>query</var>’s <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list⑥">list</a> to the result of <a data-link-type="dfn" href="#concept-urlencoded-string-parser" id="ref-for-concept-urlencoded-string-parser②">parsing</a> <var>init</var>. </p>
    <li>
     <p>Return <var>query</var>. </p>
   </ol>
   <p>A <code class="idl"><a data-link-type="idl" href="#urlsearchparams" id="ref-for-urlsearchparams⑧">URLSearchParams</a></code> object’s <dfn class="dfn-paneled" data-dfn-for="URLSearchParams" data-dfn-type="dfn" data-noexport id="concept-urlsearchparams-update">update steps</dfn> are to run these
steps: </p>
   <ol>
    <li>
     <p>Let <var>query</var> be the <a data-link-type="dfn" href="#concept-urlencoded-serializer" id="ref-for-concept-urlencoded-serializer">serialization</a> of <code class="idl"><a data-link-type="idl" href="#urlsearchparams" id="ref-for-urlsearchparams⑨">URLSearchParams</a></code> object’s <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list⑦">list</a>. </p>
    <li>
     <p>If <var>query</var> is the empty string, then set <var>query</var> to null. </p>
    <li>
     <p>Set <a data-link-type="dfn" href="#concept-urlsearchparams-url-object" id="ref-for-concept-urlsearchparams-url-object①">url object</a>’s <a data-link-type="dfn" href="#concept-url-url" id="ref-for-concept-url-url④①">url</a>’s <a data-link-type="dfn" href="#concept-url-query" id="ref-for-concept-url-query②⑦">query</a> to <var>query</var>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URLSearchParams" data-dfn-type="constructor" data-export data-lt="URLSearchParams(init)|constructor(init)|URLSearchParams()|constructor()" id="dom-urlsearchparams-urlsearchparams"><code>URLSearchParams(<var>init</var>)</code></dfn> constructor, when invoked, must run these steps:</p>
   <ol>
    <li>
     <p>If <var>init</var> is a string and starts with U+003F (?), remove the first code point from <var>init</var>. </p>
    <li>
     <p>Return a <a data-link-type="dfn" href="#concept-urlsearchparams-new" id="ref-for-concept-urlsearchparams-new①">new</a> <code class="idl"><a data-link-type="idl" href="#urlsearchparams" id="ref-for-urlsearchparams①⓪">URLSearchParams</a></code> object using <var>init</var>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URLSearchParams" data-dfn-type="method" data-export id="dom-urlsearchparams-append"><code>append(<var>name</var>, <var>value</var>)</code></dfn> method, when invoked, must run these steps: </p>
   <ol>
    <li>
     <p>Append a new name-value pair whose name is <var>name</var> and
 value is <var>value</var>, to <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list⑧">list</a>. </p>
    <li>
     <p>Run the <a data-link-type="dfn" href="#concept-urlsearchparams-update" id="ref-for-concept-urlsearchparams-update">update steps</a>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URLSearchParams" data-dfn-type="method" data-export id="dom-urlsearchparams-delete"><code>delete(<var>name</var>)</code></dfn> method, when
invoked, must run these steps: </p>
   <ol>
    <li>
     <p>Remove all name-value pairs whose name is <var>name</var> from <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list⑨">list</a>. </p>
    <li>
     <p>Run the <a data-link-type="dfn" href="#concept-urlsearchparams-update" id="ref-for-concept-urlsearchparams-update①">update steps</a>. </p>
   </ol>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URLSearchParams" data-dfn-type="method" data-export id="dom-urlsearchparams-get"><code>get(<var>name</var>)</code></dfn> method, when invoked, must return the value of the first name-value pair whose name is <var>name</var> in <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list①⓪">list</a>, if there is such a pair, and null otherwise. </p>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URLSearchParams" data-dfn-type="method" data-export id="dom-urlsearchparams-getall"><code>getAll(<var>name</var>)</code></dfn> method, when invoked, must return the values of all name-value pairs whose name is <var>name</var>,
in <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list①①">list</a>, in list order, and the empty sequence otherwise. </p>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URLSearchParams" data-dfn-type="method" data-export id="dom-urlsearchparams-has"><code>has(<var>name</var>)</code></dfn> method, when invoked, must return true if there is a name-value pair whose name is <var>name</var> in <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list①②">list</a>, and false otherwise. </p>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URLSearchParams" data-dfn-type="method" data-export id="dom-urlsearchparams-set"><code>set(<var>name</var>, <var>value</var>)</code></dfn> method, when invoked, must run these steps: </p>
   <ol>
    <li>
     <p>If there are any name-value pairs whose name is <var>name</var>, in <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list①③">list</a>, set the value of the first such name-value pair to <var>value</var> and remove the others. </p>
    <li>
     <p>Otherwise, append a new name-value pair whose name is <var>name</var> and value is <var>value</var>, to <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list①④">list</a>. </p>
    <li>
     <p>Run the <a data-link-type="dfn" href="#concept-urlsearchparams-update" id="ref-for-concept-urlsearchparams-update②">update steps</a>. </p>
   </ol>
   <hr>
   <div class="example" id="example-searchparams-sort">
    <a class="self-link" href="#example-searchparams-sort"></a> 
    <p>It can be useful to sort the name-value pairs in a <code class="idl"><a data-link-type="idl" href="#urlsearchparams" id="ref-for-urlsearchparams①①">URLSearchParams</a></code> object, in particular to
 increase cache hits. This can be accomplished through invoking the <code class="idl"><a data-link-type="idl" href="#dom-urlsearchparams-sort" id="ref-for-dom-urlsearchparams-sort①">sort()</a></code> method: </p>
<pre><code class="lang-javascript highlight"><c- kr>const</c-> url <c- o>=</c-> <c- k>new</c-> URL<c- p>(</c-><c- u>"https://example.org/?q=🏳️‍🌈&amp;key=e1f7bc78"</c-><c- p>);</c->
url<c- p>.</c->searchParams<c- p>.</c->sort<c- p>();</c->
url<c- p>.</c->search<c- p>;</c-> <c- c1>// "?key=e1f7bc78&amp;q=%F0%9F%8F%B3%EF%B8%8F%E2%80%8D%F0%9F%8C%88"</c-></code></pre>
    <p>To avoid altering the original input, e.g., for comparison purposes, construct a new <code class="idl"><a data-link-type="idl" href="#urlsearchparams" id="ref-for-urlsearchparams①②">URLSearchParams</a></code> object: </p>
<pre><code class="lang-javascript highlight"><c- kr>const</c-> sorted <c- o>=</c-> <c- k>new</c-> URLSearchParams<c- p>(</c->url<c- p>.</c->search<c- p>)</c->
sorted<c- p>.</c->sort<c- p>()</c-></code></pre>
   </div>
   <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="URLSearchParams" data-dfn-type="method" data-export id="dom-urlsearchparams-sort"><code>sort()</code></dfn> method, when invoked, must run
these steps: </p>
   <ol>
    <li>
     <p>Sort all name-value pairs, if any, by their names. Sorting must be done by comparison of
 code units. The relative order between name-value pairs with equal names must be preserved. </p>
    <li>
     <p>Run the <a data-link-type="dfn" href="#concept-urlsearchparams-update" id="ref-for-concept-urlsearchparams-update③">update steps</a>. </p>
   </ol>
   <hr>
   <p>The <a data-link-type="dfn" href="https://heycam.github.io/webidl/#dfn-value-pairs-to-iterate-over" id="ref-for-dfn-value-pairs-to-iterate-over">value pairs to iterate over</a> are the <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list①⑤">list</a> name-value pairs with the key being
the name and the value being the value. </p>
   <p>The <dfn class="dfn-paneled" data-dfn-for="URLSearchParams" data-dfn-type="dfn" data-lt="stringificationbehavior" data-noexport id="urlsearchparams-stringification-behavior">stringification behavior</dfn> must return the <a data-link-type="dfn" href="#concept-urlencoded-serializer" id="ref-for-concept-urlencoded-serializer①">serialization</a> of the <code class="idl"><a data-link-type="idl" href="#urlsearchparams" id="ref-for-urlsearchparams①③">URLSearchParams</a></code> object’s <a data-link-type="dfn" href="#concept-urlsearchparams-list" id="ref-for-concept-urlsearchparams-list①⑥">list</a>. </p>
   <h3 class="heading settled" data-level="6.3" id="url-apis-elsewhere"><span class="secno">6.3. </span><span class="content">URL APIs elsewhere</span><a class="self-link" href="#url-apis-elsewhere"></a></h3>
   <p>A standard that exposes <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑥①">URLs</a>, should expose the <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑥②">URL</a> as a string (by <a data-link-type="dfn" href="#concept-url-serializer" id="ref-for-concept-url-serializer⑧">serializing</a> an internal <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑥③">URL</a>). A standard should not expose a <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑥④">URL</a> using a <code class="idl"><a data-link-type="idl" href="#url" id="ref-for-url⑥">URL</a></code> object. <code class="idl"><a data-link-type="idl" href="#url" id="ref-for-url⑦">URL</a></code> objects are meant for <a data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑥⑤">URL</a> manipulation. In IDL the USVString type should be used. </p>
   <p class="note" role="note">The higher-level notion here is that values are to be exposed as immutable data
structures. </p>
   <p>If a standard decides to use a variant of the name "URL" for a feature it defines, it should name
such a feature "url" (i.e., lowercase and with an "l" at the end). Names such as "URL", "URI", and
"IRI" should not be used. However, if the name is a compound, "URL" (i.e., uppercase) is preferred,
e.g., "newURL" and "oldURL". </p>
   <p class="note" role="note">The <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/server-sent-events.html#eventsource" id="ref-for-eventsource">EventSource</a></code> and <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#hashchangeevent" id="ref-for-hashchangeevent">HashChangeEvent</a></code> interfaces in HTML are examples of proper
naming. <a data-link-type="biblio" href="#biblio-html">[HTML]</a> </p>
   <h2 class="no-num heading settled" id="acknowledgments"><span class="content">Acknowledgments</span><a class="self-link" href="#acknowledgments"></a></h2>
   <p>There have been a lot of people that have helped make <a class="no-backref" data-link-type="dfn" href="#concept-url" id="ref-for-concept-url⑥⑥">URLs</a> more interoperable over the years and thereby furthered the goals of this standard. Likewise many
people have helped making this standard what it is today. </p>
   <p>With that, many thanks to
100の人,
Adam Barth,
Addison Phillips,
Albert Wiersch,
Alex Christensen,
Alexandre Morgaut,
Andrew Sullivan,
Arkadiusz Michalski,
Behnam Esfahbod,
Bobby Holley,
Boris Zbarsky,
Brad Hill,
Brandon Ross,
Chris Dumez,
Chris Rebert,
Corey Farwell,
Dan Appelquist,
Daniel Bratell,
Daniel Stenberg,
David Burns,
David Håsäther,
David Sheets,
David Singer,
David Walp,
Domenic Denicola,
Emily Schechter,
Emily Stark,
Eric Lawrence,
Erik Arvidsson,
Gavin Carothers,
Geoff Richards,
Glenn Maynard,
Gordon P. Hemsley,
Henri Sivonen,
Ian Hickson,
Ilya Grigorik,
Italo A. Casas,
Jakub Gieryluk,
James Graham,
James Manger,
James Ross,
Jeffrey Posnick,
Jeffrey Yasskin,
Joe Duarte,
Joshua Bell,
Jxck,
田村健人 (Kent TAMURA),
Kevin Grandon,
Kornel Lesiński,
Larry Masinter,
Leif Halvard Silli,
Mark Davis,
Marcos Cáceres,
Marijn Kruisselbrink,
Martin Dürst,
Mathias Bynens,
Michael Peick,
Michael™ Smith,
Michal Bukovský,
Michel Suignard,
Noah Levitt,
Peter Occil,
Philip Jägenstedt,
Philippe Ombredanne,
Prayag Verma,
Rimas Misevičius,
Robert Kieffer,
Rodney Rehm,
Roy Fielding,
Ryan Sleevi,
Sam Ruby,
Santiago M. Mola,
Sebastian Mayr,
Simon Pieters,
Simon Sapin,
Steven Vachon,
Stuart Cook,
Sven Uhlig,
Tab Atkins,
吉野剛史 (Takeshi Yoshino),
Tantek Çelik,
Tiancheng "Timothy" Gu,
Tim Berners-Lee,
簡冠庭 (Tim Guan-tin Chien),
Titi_Alone,
Tomek Wytrębowicz,
Trevor Rowbotham,
Valentin Gosu,
Vyacheslav Matva,
Wei Wang,
山岸和利 (Yamagishi Kazutoshi), and
成瀬ゆい (Yui Naruse)
for being awesome! </p>
   <p>This standard is written by <a href="https://annevankesteren.nl/" lang="nl">Anne van Kesteren</a> (<a href="https://www.mozilla.org/">Mozilla</a>, <a href="mailto:annevk@annevk.nl">annevk@annevk.nl</a>). </p>
   <p>Copyright © 1970 WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a <a href="https://creativecommons.org/licenses/by/4.0/" rel="license">Creative Commons Attribution
4.0 International License</a>. </p>
  </main>
<script>
"use strict";
if ("serviceWorker" in navigator) {
  navigator.serviceWorker.register("/service-worker.js");
}
</script>
  <h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2>
  <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3>
  <ul class="index">
   <li><a href="#absolute-url-string">absolute-URL string</a><span>, in §4.3</span>
   <li><a href="#absolute-url-with-fragment-string">absolute-URL-with-fragment string</a><span>, in §4.3</span>
   <li><a href="#dom-urlsearchparams-append">append(name, value)</a><span>, in §6.2</span>
   <li><a href="#concept-urlencoded">application/x-www-form-urlencoded</a><span>, in §5</span>
   <li><a href="#authority-state">authority state</a><span>, in §4.4</span>
   <li><a href="#concept-base-url">base URL</a><span>, in §4.2</span>
   <li><a href="#concept-basic-url-parser">basic URL parser</a><span>, in §4.4</span>
   <li><a href="#concept-url-blob-entry">blob URL entry</a><span>, in §4.1</span>
   <li><a href="#c">c</a><span>, in §1.2</span>
   <li><a href="#c0-control-percent-encode-set">C0 control percent-encode set</a><span>, in §1.3</span>
   <li><a href="#url-cannot-be-a-base-url-flag">cannot-be-a-base-URL flag</a><span>, in §4.1</span>
   <li><a href="#cannot-be-a-base-url-path-state">cannot-be-a-base-URL path state</a><span>, in §4.4</span>
   <li><a href="#cannot-have-a-username-password-port">cannot have a username/password/port</a><span>, in §4.2</span>
   <li><a href="#dom-urlsearchparams-urlsearchparams">constructor()</a><span>, in §6.2</span>
   <li><a href="#dom-urlsearchparams-urlsearchparams">constructor(init)</a><span>, in §6.2</span>
   <li><a href="#dom-url-url">constructor(url)</a><span>, in §6.1</span>
   <li><a href="#dom-url-url">constructor(url, base)</a><span>, in §6.1</span>
   <li><a href="#default-port">default port</a><span>, in §4.2</span>
   <li><a href="#dom-urlsearchparams-delete">delete(name)</a><span>, in §6.2</span>
   <li><a href="#concept-domain">domain</a><span>, in §3.1</span>
   <li><a href="#concept-domain-to-ascii">domain to ASCII</a><span>, in §3.3</span>
   <li><a href="#concept-domain-to-unicode">domain to Unicode</a><span>, in §3.3</span>
   <li><a href="#double-dot-path-segment">double-dot path segment</a><span>, in §4.3</span>
   <li><a href="#empty-host">empty host</a><span>, in §3.1</span>
   <li><a href="#eof-code-point">EOF code point</a><span>, in §1.2</span>
   <li>
    equal
    <ul>
     <li><a href="#concept-host-equals">dfn for host</a><span>, in §3.7</span>
     <li><a href="#concept-url-equals">dfn for url</a><span>, in §4.6</span>
    </ul>
   <li><a href="#file-host-state">file host state</a><span>, in §4.4</span>
   <li><a href="#file-slash-state">file slash state</a><span>, in §4.4</span>
   <li><a href="#file-state">file state</a><span>, in §4.4</span>
   <li><a href="#forbidden-host-code-point">forbidden host code point</a><span>, in §3.2</span>
   <li><a href="#concept-url-fragment">fragment</a><span>, in §4.1</span>
   <li><a href="#fragment-percent-encode-set">fragment percent-encode set</a><span>, in §1.3</span>
   <li><a href="#fragment-state">fragment state</a><span>, in §4.4</span>
   <li><a href="#dom-urlsearchparams-getall">getAll(name)</a><span>, in §6.2</span>
   <li><a href="#dom-urlsearchparams-get">get(name)</a><span>, in §6.2</span>
   <li><a href="#dom-url-hash">hash</a><span>, in §6.1</span>
   <li><a href="#dom-urlsearchparams-has">has(name)</a><span>, in §6.2</span>
   <li>
    host
    <ul>
     <li><a href="#dom-url-host">attribute for URL</a><span>, in §6.1</span>
     <li><a href="#concept-host">definition of</a><span>, in §3.1</span>
     <li><a href="#concept-url-host">dfn for url</a><span>, in §4.1</span>
    </ul>
   <li><a href="#dom-url-hostname">hostname</a><span>, in §6.1</span>
   <li><a href="#hostname-state">hostname state</a><span>, in §4.4</span>
   <li><a href="#concept-host-parser">host parser</a><span>, in §3.5</span>
   <li><a href="#concept-host-parser">host parsing</a><span>, in §3.5</span>
   <li><a href="#concept-host-serializer">host serializer</a><span>, in §3.6</span>
   <li><a href="#host-state">host state</a><span>, in §4.4</span>
   <li><a href="#dom-url-href">href</a><span>, in §6.1</span>
   <li><a href="#include-credentials">include credentials</a><span>, in §4.2</span>
   <li><a href="#include-credentials">includes credentials</a><span>, in §4.2</span>
   <li><a href="#concept-ipv4">IPv4 address</a><span>, in §3.1</span>
   <li><a href="#ipv4-number-parser">IPv4 number parser</a><span>, in §3.5</span>
   <li><a href="#concept-ipv4-parser">IPv4 parser</a><span>, in §3.5</span>
   <li><a href="#concept-ipv4-serializer">IPv4 serializer</a><span>, in §3.6</span>
   <li><a href="#concept-ipv6">IPv6 address</a><span>, in §3.1</span>
   <li><a href="#concept-ipv6-parser">IPv6 parser</a><span>, in §3.5</span>
   <li><a href="#concept-ipv6-piece">IPv6 piece</a><span>, in §3.1</span>
   <li><a href="#concept-ipv6-serializer">IPv6 serializer</a><span>, in §3.6</span>
   <li><a href="#is-not-special">is not special</a><span>, in §4.2</span>
   <li><a href="#is-special">is special</a><span>, in §4.2</span>
   <li><a href="#concept-urlsearchparams-list">list</a><span>, in §6.2</span>
   <li><a href="#concept-urlsearchparams-new">new</a><span>, in §6.2</span>
   <li><a href="#normalized-windows-drive-letter">normalized Windows drive letter</a><span>, in §4.2</span>
   <li><a href="#no-scheme-state">no scheme state</a><span>, in §4.4</span>
   <li><a href="#opaque-host">opaque host</a><span>, in §3.1</span>
   <li><a href="#opaque-host-and-port-string">opaque-host-and-port string</a><span>, in §4.3</span>
   <li><a href="#concept-opaque-host-parser">opaque-host parser</a><span>, in §3.5</span>
   <li>
    origin
    <ul>
     <li><a href="#dom-url-origin">attribute for URL</a><span>, in §6.1</span>
     <li><a href="#concept-url-origin">dfn for url</a><span>, in §4.7</span>
    </ul>
   <li>
    password
    <ul>
     <li><a href="#dom-url-password">attribute for URL</a><span>, in §6.1</span>
     <li><a href="#concept-url-password">dfn for url</a><span>, in §4.1</span>
    </ul>
   <li><a href="#concept-url-path">path</a><span>, in §4.1</span>
   <li><a href="#path-absolute-non-windows-file-url-string">path-absolute-non-Windows-file-URL string</a><span>, in §4.3</span>
   <li><a href="#path-absolute-url-string">path-absolute-URL string</a><span>, in §4.3</span>
   <li><a href="#dom-url-pathname">pathname</a><span>, in §6.1</span>
   <li><a href="#path-or-authority-state">path or authority state</a><span>, in §4.4</span>
   <li><a href="#path-percent-encode-set">path percent-encode set</a><span>, in §1.3</span>
   <li><a href="#path-relative-scheme-less-url-string">path-relative-scheme-less-URL string</a><span>, in §4.3</span>
   <li><a href="#path-relative-url-string">path-relative-URL string</a><span>, in §4.3</span>
   <li><a href="#path-start-state">path start state</a><span>, in §4.4</span>
   <li><a href="#path-state">path state</a><span>, in §4.4</span>
   <li><a href="#percent-decode">percent decode</a><span>, in §1.3</span>
   <li><a href="#percent-encode">percent encode</a><span>, in §1.3</span>
   <li><a href="#percent-encoded-byte">percent-encoded byte</a><span>, in §1.3</span>
   <li>
    port
    <ul>
     <li><a href="#dom-url-port">attribute for URL</a><span>, in §6.1</span>
     <li><a href="#concept-url-port">dfn for url</a><span>, in §4.1</span>
    </ul>
   <li><a href="#port-state">port state</a><span>, in §4.4</span>
   <li><a href="#dom-url-protocol">protocol</a><span>, in §6.1</span>
   <li><a href="#host-public-suffix">public suffix</a><span>, in §3.2</span>
   <li><a href="#concept-url-query">query</a><span>, in §4.1</span>
   <li><a href="#concept-url-query-object">query object</a><span>, in §6.1</span>
   <li><a href="#query-state">query state</a><span>, in §4.4</span>
   <li><a href="#host-registrable-domain">registrable domain</a><span>, in §3.2</span>
   <li><a href="#relative-slash-state">relative slash state</a><span>, in §4.4</span>
   <li><a href="#relative-state">relative state</a><span>, in §4.4</span>
   <li><a href="#relative-url-string">relative-URL string</a><span>, in §4.3</span>
   <li><a href="#relative-url-with-fragment-string">relative-URL-with-fragment string</a><span>, in §4.3</span>
   <li><a href="#remaining">remaining</a><span>, in §1.2</span>
   <li><a href="#concept-url-scheme">scheme</a><span>, in §4.1</span>
   <li><a href="#scheme-relative-file-url-string">scheme-relative-file-URL string</a><span>, in §4.3</span>
   <li><a href="#scheme-relative-special-url-string">scheme-relative-special-URL string</a><span>, in §4.3</span>
   <li><a href="#scheme-relative-url-string">scheme-relative-URL string</a><span>, in §4.3</span>
   <li><a href="#scheme-start-state">scheme start state</a><span>, in §4.4</span>
   <li><a href="#scheme-state">scheme state</a><span>, in §4.4</span>
   <li><a href="#dom-url-search">search</a><span>, in §6.1</span>
   <li><a href="#dom-url-searchparams">searchParams</a><span>, in §6.1</span>
   <li><a href="#serialize-an-integer">serialize an integer</a><span>, in §1</span>
   <li><a href="#dom-urlsearchparams-set">set(name, value)</a><span>, in §6.2</span>
   <li><a href="#set-the-password">set the password</a><span>, in §4.4</span>
   <li><a href="#set-the-username">set the username</a><span>, in §4.4</span>
   <li><a href="#shorten-a-urls-path">shorten</a><span>, in §4.2</span>
   <li><a href="#shorten-a-urls-path">shorten a url’s path</a><span>, in §4.2</span>
   <li><a href="#single-dot-path-segment">single-dot path segment</a><span>, in §4.3</span>
   <li><a href="#dom-urlsearchparams-sort">sort()</a><span>, in §6.2</span>
   <li><a href="#special-authority-ignore-slashes-state">special authority ignore slashes state</a><span>, in §4.4</span>
   <li><a href="#special-authority-slashes-state">special authority slashes state</a><span>, in §4.4</span>
   <li><a href="#special-relative-or-authority-state">special relative or authority state</a><span>, in §4.4</span>
   <li><a href="#special-scheme">special scheme</a><span>, in §4.2</span>
   <li><a href="#start-with-a-windows-drive-letter">starts with a Windows drive letter</a><span>, in §4.2</span>
   <li><a href="#start-with-a-windows-drive-letter">start with a Windows drive letter</a><span>, in §4.2</span>
   <li><a href="#urlsearchparams-stringification-behavior">stringificationbehavior</a><span>, in §6.2</span>
   <li><a href="#URL-stringification-behavior">stringification behavior</a><span>, in §6.1</span>
   <li><a href="#string-percent-decode">string percent decode</a><span>, in §1.3</span>
   <li><a href="#dom-url-tojson">toJSON()</a><span>, in §6.1</span>
   <li><a href="#concept-urlsearchparams-update">update steps</a><span>, in §6.2</span>
   <li>
    URL
    <ul>
     <li><a href="#url">(interface)</a><span>, in §6.1</span>
     <li><a href="#concept-url">definition of</a><span>, in §4.1</span>
    </ul>
   <li><a href="#concept-url-url">url</a><span>, in §6.1</span>
   <li><a href="#url-code-points">URL code point</a><span>, in §4.3</span>
   <li><a href="#concept-urlencoded-byte-serializer">urlencoded byte serializer</a><span>, in §5.2</span>
   <li><a href="#concept-urlencoded-parser">urlencoded parser</a><span>, in §5.1</span>
   <li><a href="#concept-urlencoded-serializer">urlencoded serializer</a><span>, in §5.2</span>
   <li><a href="#concept-urlencoded-string-parser">urlencoded string parser</a><span>, in §5.3</span>
   <li><a href="#url-fragment-string">URL-fragment string</a><span>, in §4.3</span>
   <li><a href="#concept-urlsearchparams-url-object">url object</a><span>, in §6.2</span>
   <li><a href="#concept-url-parser">URL parser</a><span>, in §4.4</span>
   <li><a href="#url-path-segment-string">URL-path-segment string</a><span>, in §4.3</span>
   <li><a href="#url-port-string">URL-port string</a><span>, in §4.3</span>
   <li><a href="#url-query-string">URL-query string</a><span>, in §4.3</span>
   <li><a href="#concept-url">URL record</a><span>, in §4.1</span>
   <li><a href="#url-scheme-string">URL-scheme string</a><span>, in §4.3</span>
   <li><a href="#urlsearchparams">URLSearchParams</a><span>, in §6.2</span>
   <li><a href="#dom-urlsearchparams-urlsearchparams">URLSearchParams()</a><span>, in §6.2</span>
   <li><a href="#dom-urlsearchparams-urlsearchparams">URLSearchParams(init)</a><span>, in §6.2</span>
   <li><a href="#concept-url-serializer">URL serializer</a><span>, in §4.5</span>
   <li><a href="#url-units">URL units</a><span>, in §4.3</span>
   <li><a href="#dom-url-url">URL(url)</a><span>, in §6.1</span>
   <li><a href="#dom-url-url">URL(url, base)</a><span>, in §6.1</span>
   <li><a href="#userinfo-percent-encode-set">userinfo percent-encode set</a><span>, in §1.3</span>
   <li>
    username
    <ul>
     <li><a href="#dom-url-username">attribute for URL</a><span>, in §6.1</span>
     <li><a href="#concept-url-username">dfn for url</a><span>, in §4.1</span>
    </ul>
   <li><a href="#utf-8-percent-encode">UTF-8 percent encode</a><span>, in §1.3</span>
   <li><a href="#validation-error">validation error</a><span>, in §1.1</span>
   <li><a href="#valid-domain">valid domain</a><span>, in §3.4</span>
   <li><a href="#valid-domain-string">valid domain string</a><span>, in §3.4</span>
   <li><a href="#valid-host-string">valid host string</a><span>, in §3.4</span>
   <li><a href="#valid-ipv4-address-string">valid IPv4-address string</a><span>, in §3.4</span>
   <li><a href="#valid-ipv6-address-string">valid IPv6-address string</a><span>, in §3.4</span>
   <li><a href="#valid-opaque-host-string">valid opaque-host string</a><span>, in §3.4</span>
   <li><a href="#valid-url-string">valid URL string</a><span>, in §4.3</span>
   <li><a href="#webkiturl">webkitURL</a><span>, in §6.1</span>
   <li><a href="#windows-drive-letter">Windows drive letter</a><span>, in §4.2</span>
  </ul>
  <aside class="dfn-panel" data-for="term-for-context-object">
   <a href="https://dom.spec.whatwg.org/#context-object">https://dom.spec.whatwg.org/#context-object</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-context-object">6.1. URL class</a> <a href="#ref-for-context-object①">(2)</a> <a href="#ref-for-context-object②">(3)</a> <a href="#ref-for-context-object③">(4)</a> <a href="#ref-for-context-object④">(5)</a> <a href="#ref-for-context-object⑤">(6)</a> <a href="#ref-for-context-object⑥">(7)</a> <a href="#ref-for-context-object⑦">(8)</a> <a href="#ref-for-context-object⑧">(9)</a> <a href="#ref-for-context-object⑨">(10)</a> <a href="#ref-for-context-object①⓪">(11)</a> <a href="#ref-for-context-object①①">(12)</a> <a href="#ref-for-context-object①②">(13)</a> <a href="#ref-for-context-object①③">(14)</a> <a href="#ref-for-context-object①④">(15)</a> <a href="#ref-for-context-object①⑤">(16)</a> <a href="#ref-for-context-object①⑥">(17)</a> <a href="#ref-for-context-object①⑦">(18)</a> <a href="#ref-for-context-object①⑧">(19)</a> <a href="#ref-for-context-object①⑨">(20)</a> <a href="#ref-for-context-object②⓪">(21)</a> <a href="#ref-for-context-object②①">(22)</a> <a href="#ref-for-context-object②②">(23)</a> <a href="#ref-for-context-object②③">(24)</a> <a href="#ref-for-context-object②④">(25)</a> <a href="#ref-for-context-object②⑤">(26)</a> <a href="#ref-for-context-object②⑥">(27)</a> <a href="#ref-for-context-object②⑦">(28)</a> <a href="#ref-for-context-object②⑧">(29)</a> <a href="#ref-for-context-object②⑨">(30)</a> <a href="#ref-for-context-object③⓪">(31)</a> <a href="#ref-for-context-object③①">(32)</a> <a href="#ref-for-context-object③②">(33)</a> <a href="#ref-for-context-object③③">(34)</a> <a href="#ref-for-context-object③④">(35)</a> <a href="#ref-for-context-object③⑤">(36)</a> <a href="#ref-for-context-object③⑥">(37)</a> <a href="#ref-for-context-object③⑦">(38)</a> <a href="#ref-for-context-object③⑧">(39)</a> <a href="#ref-for-context-object③⑨">(40)</a> <a href="#ref-for-context-object④⓪">(41)</a> <a href="#ref-for-context-object④①">(42)</a> <a href="#ref-for-context-object④②">(43)</a> <a href="#ref-for-context-object④③">(44)</a> <a href="#ref-for-context-object④④">(45)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-encode">
   <a href="https://encoding.spec.whatwg.org/#encode">https://encoding.spec.whatwg.org/#encode</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-encode">4.4. URL parsing</a> <a href="#ref-for-encode①">(2)</a>
    <li><a href="#ref-for-encode②">5.2. application/x-www-form-urlencoded serializing</a> <a href="#ref-for-encode③">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-encoding">
   <a href="https://encoding.spec.whatwg.org/#encoding">https://encoding.spec.whatwg.org/#encoding</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-encoding">4.4. URL parsing</a> <a href="#ref-for-encoding①">(2)</a> <a href="#ref-for-encoding②">(3)</a>
    <li><a href="#ref-for-encoding③">5.1. application/x-www-form-urlencoded parsing</a>
    <li><a href="#ref-for-encoding④">5.2. application/x-www-form-urlencoded serializing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-get-an-output-encoding">
   <a href="https://encoding.spec.whatwg.org/#get-an-output-encoding">https://encoding.spec.whatwg.org/#get-an-output-encoding</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-get-an-output-encoding">4.4. URL parsing</a>
    <li><a href="#ref-for-get-an-output-encoding①">5.2. application/x-www-form-urlencoded serializing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-utf-8">
   <a href="https://encoding.spec.whatwg.org/#utf-8">https://encoding.spec.whatwg.org/#utf-8</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-utf-8">4.3. URL writing</a>
    <li><a href="#ref-for-utf-8①">4.4. URL parsing</a> <a href="#ref-for-utf-8②">(2)</a> <a href="#ref-for-utf-8③">(3)</a> <a href="#ref-for-utf-8④">(4)</a>
    <li><a href="#ref-for-utf-8⑤">5.1. application/x-www-form-urlencoded parsing</a> <a href="#ref-for-utf-8⑥">(2)</a>
    <li><a href="#ref-for-utf-8⑦">5.2. application/x-www-form-urlencoded serializing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-utf-8-decode-without-bom">
   <a href="https://encoding.spec.whatwg.org/#utf-8-decode-without-bom">https://encoding.spec.whatwg.org/#utf-8-decode-without-bom</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-utf-8-decode-without-bom">1.3. Percent-encoded bytes</a> <a href="#ref-for-utf-8-decode-without-bom①">(2)</a>
    <li><a href="#ref-for-utf-8-decode-without-bom②">3.5. Host parsing</a>
    <li><a href="#ref-for-utf-8-decode-without-bom③">5.1. application/x-www-form-urlencoded parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-utf-8-decode-without-bom-or-fail">
   <a href="https://encoding.spec.whatwg.org/#utf-8-decode-without-bom-or-fail">https://encoding.spec.whatwg.org/#utf-8-decode-without-bom-or-fail</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-utf-8-decode-without-bom-or-fail">1.3. Percent-encoded bytes</a>
    <li><a href="#ref-for-utf-8-decode-without-bom-or-fail①">3.5. Host parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-utf-8-encode">
   <a href="https://encoding.spec.whatwg.org/#utf-8-encode">https://encoding.spec.whatwg.org/#utf-8-encode</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-utf-8-encode">1.3. Percent-encoded bytes</a> <a href="#ref-for-utf-8-encode①">(2)</a>
    <li><a href="#ref-for-utf-8-encode②">5.3. Hooks</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-blob-url-entry">
   <a href="https://w3c.github.io/FileAPI/#blob-url-entry">https://w3c.github.io/FileAPI/#blob-url-entry</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-blob-url-entry">4.1. URL representation</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-BlobURLStore">
   <a href="https://w3c.github.io/FileAPI/#BlobURLStore">https://w3c.github.io/FileAPI/#BlobURLStore</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-BlobURLStore">4.1. URL representation</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-blob-url-entry-environment">
   <a href="https://w3c.github.io/FileAPI/#blob-url-entry-environment">https://w3c.github.io/FileAPI/#blob-url-entry-environment</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-blob-url-entry-environment">4.7. Origin</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-blob-url-resolve">
   <a href="https://w3c.github.io/FileAPI/#blob-url-resolve">https://w3c.github.io/FileAPI/#blob-url-resolve</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-blob-url-resolve">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-eventsource">
   <a href="https://html.spec.whatwg.org/multipage/server-sent-events.html#eventsource">https://html.spec.whatwg.org/multipage/server-sent-events.html#eventsource</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-eventsource">6.3. URL APIs elsewhere</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-hashchangeevent">
   <a href="https://html.spec.whatwg.org/multipage/browsing-the-web.html#hashchangeevent">https://html.spec.whatwg.org/multipage/browsing-the-web.html#hashchangeevent</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-hashchangeevent">6.3. URL APIs elsewhere</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-location">
   <a href="https://html.spec.whatwg.org/multipage/history.html#location">https://html.spec.whatwg.org/multipage/history.html#location</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-location">4.4. URL parsing</a> <a href="#ref-for-location①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-origin-opaque">
   <a href="https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque">https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-origin-opaque">4.7. Origin</a> <a href="#ref-for-concept-origin-opaque①">(2)</a> <a href="#ref-for-concept-origin-opaque②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-concept-settings-object-origin">
   <a href="https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin">https://html.spec.whatwg.org/multipage/webappapis.html#concept-settings-object-origin</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-settings-object-origin">4.7. Origin</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dom-location-protocol">
   <a href="https://html.spec.whatwg.org/multipage/history.html#dom-location-protocol">https://html.spec.whatwg.org/multipage/history.html#dom-location-protocol</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-location-protocol">4.4. URL parsing</a> <a href="#ref-for-dom-location-protocol①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-same-origin">
   <a href="https://html.spec.whatwg.org/multipage/origin.html#same-origin">https://html.spec.whatwg.org/multipage/origin.html#same-origin</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-same-origin">4.7. Origin</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-same-site">
   <a href="https://html.spec.whatwg.org/multipage/infrastructure.html#same-site">https://html.spec.whatwg.org/multipage/infrastructure.html#same-site</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-same-site">3.2. Host miscellaneous</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ascii-serialisation-of-an-origin">
   <a href="https://html.spec.whatwg.org/multipage/origin.html#ascii-serialisation-of-an-origin">https://html.spec.whatwg.org/multipage/origin.html#ascii-serialisation-of-an-origin</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-serialisation-of-an-origin">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-list-append">
   <a href="https://infra.spec.whatwg.org/#list-append">https://infra.spec.whatwg.org/#list-append</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-append">4.4. URL parsing</a> <a href="#ref-for-list-append①">(2)</a> <a href="#ref-for-list-append②">(3)</a> <a href="#ref-for-list-append③">(4)</a> <a href="#ref-for-list-append④">(5)</a>
    <li><a href="#ref-for-list-append⑤">5.1. application/x-www-form-urlencoded parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ascii-alpha">
   <a href="https://infra.spec.whatwg.org/#ascii-alpha">https://infra.spec.whatwg.org/#ascii-alpha</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-alpha">4.2. URL miscellaneous</a>
    <li><a href="#ref-for-ascii-alpha①">4.3. URL writing</a>
    <li><a href="#ref-for-ascii-alpha②">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ascii-alphanumeric">
   <a href="https://infra.spec.whatwg.org/#ascii-alphanumeric">https://infra.spec.whatwg.org/#ascii-alphanumeric</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-alphanumeric">4.3. URL writing</a> <a href="#ref-for-ascii-alphanumeric①">(2)</a>
    <li><a href="#ref-for-ascii-alphanumeric②">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ascii-byte">
   <a href="https://infra.spec.whatwg.org/#ascii-byte">https://infra.spec.whatwg.org/#ascii-byte</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-byte">1.3. Percent-encoded bytes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ascii-case-insensitive">
   <a href="https://infra.spec.whatwg.org/#ascii-case-insensitive">https://infra.spec.whatwg.org/#ascii-case-insensitive</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-case-insensitive">4.3. URL writing</a> <a href="#ref-for-ascii-case-insensitive①">(2)</a> <a href="#ref-for-ascii-case-insensitive②">(3)</a> <a href="#ref-for-ascii-case-insensitive③">(4)</a> <a href="#ref-for-ascii-case-insensitive④">(5)</a> <a href="#ref-for-ascii-case-insensitive⑤">(6)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ascii-digit">
   <a href="https://infra.spec.whatwg.org/#ascii-digit">https://infra.spec.whatwg.org/#ascii-digit</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-digit">3.4. Host writing</a>
    <li><a href="#ref-for-ascii-digit①">3.5. Host parsing</a> <a href="#ref-for-ascii-digit②">(2)</a>
    <li><a href="#ref-for-ascii-digit③">4.3. URL writing</a>
    <li><a href="#ref-for-ascii-digit④">4.4. URL parsing</a> <a href="#ref-for-ascii-digit⑤">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ascii-hex-digit">
   <a href="https://infra.spec.whatwg.org/#ascii-hex-digit">https://infra.spec.whatwg.org/#ascii-hex-digit</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-hex-digit">1.3. Percent-encoded bytes</a>
    <li><a href="#ref-for-ascii-hex-digit①">3.5. Host parsing</a> <a href="#ref-for-ascii-hex-digit②">(2)</a>
    <li><a href="#ref-for-ascii-hex-digit③">4.4. URL parsing</a> <a href="#ref-for-ascii-hex-digit④">(2)</a> <a href="#ref-for-ascii-hex-digit⑤">(3)</a> <a href="#ref-for-ascii-hex-digit⑥">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ascii-lowercase">
   <a href="https://infra.spec.whatwg.org/#ascii-lowercase">https://infra.spec.whatwg.org/#ascii-lowercase</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-lowercase">4.4. URL parsing</a> <a href="#ref-for-ascii-lowercase①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ascii-string">
   <a href="https://infra.spec.whatwg.org/#ascii-string">https://infra.spec.whatwg.org/#ascii-string</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-string">3.1. Host representation</a> <a href="#ref-for-ascii-string①">(2)</a>
    <li><a href="#ref-for-ascii-string②">4. URLs</a>
    <li><a href="#ref-for-ascii-string③">4.1. URL representation</a> <a href="#ref-for-ascii-string④">(2)</a> <a href="#ref-for-ascii-string⑤">(3)</a> <a href="#ref-for-ascii-string⑥">(4)</a> <a href="#ref-for-ascii-string⑦">(5)</a> <a href="#ref-for-ascii-string⑧">(6)</a>
    <li><a href="#ref-for-ascii-string⑨">4.5. URL serializing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ascii-tab-or-newline">
   <a href="https://infra.spec.whatwg.org/#ascii-tab-or-newline">https://infra.spec.whatwg.org/#ascii-tab-or-newline</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-tab-or-newline">4.4. URL parsing</a> <a href="#ref-for-ascii-tab-or-newline①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ascii-upper-hex-digit">
   <a href="https://infra.spec.whatwg.org/#ascii-upper-hex-digit">https://infra.spec.whatwg.org/#ascii-upper-hex-digit</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ascii-upper-hex-digit">1.3. Percent-encoded bytes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-iteration-break">
   <a href="https://infra.spec.whatwg.org/#iteration-break">https://infra.spec.whatwg.org/#iteration-break</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-iteration-break">3.5. Host parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-byte-sequence">
   <a href="https://infra.spec.whatwg.org/#byte-sequence">https://infra.spec.whatwg.org/#byte-sequence</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-byte-sequence">1.3. Percent-encoded bytes</a> <a href="#ref-for-byte-sequence①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-c0-control">
   <a href="https://infra.spec.whatwg.org/#c0-control">https://infra.spec.whatwg.org/#c0-control</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-c0-control">1.3. Percent-encoded bytes</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-c0-control-or-space">
   <a href="https://infra.spec.whatwg.org/#c0-control-or-space">https://infra.spec.whatwg.org/#c0-control-or-space</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-c0-control-or-space">4.4. URL parsing</a> <a href="#ref-for-c0-control-or-space①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-code-point">
   <a href="https://infra.spec.whatwg.org/#code-point">https://infra.spec.whatwg.org/#code-point</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-code-point">1.3. Percent-encoded bytes</a>
    <li><a href="#ref-for-code-point①">2. Security considerations</a>
    <li><a href="#ref-for-code-point②">4.3. URL writing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-iteration-continue">
   <a href="https://infra.spec.whatwg.org/#iteration-continue">https://infra.spec.whatwg.org/#iteration-continue</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-iteration-continue">3.5. Host parsing</a>
    <li><a href="#ref-for-iteration-continue①">3.6. Host serializing</a> <a href="#ref-for-iteration-continue②">(2)</a>
    <li><a href="#ref-for-iteration-continue③">4.4. URL parsing</a>
    <li><a href="#ref-for-iteration-continue④">5.1. application/x-www-form-urlencoded parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-map-iterate">
   <a href="https://infra.spec.whatwg.org/#map-iterate">https://infra.spec.whatwg.org/#map-iterate</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-map-iterate">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-list-is-empty">
   <a href="https://infra.spec.whatwg.org/#list-is-empty">https://infra.spec.whatwg.org/#list-is-empty</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-is-empty">4.1. URL representation</a>
    <li><a href="#ref-for-list-is-empty①">4.2. URL miscellaneous</a>
    <li><a href="#ref-for-list-is-empty②">4.4. URL parsing</a>
    <li><a href="#ref-for-list-is-empty③">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-isomorphic-decode">
   <a href="https://infra.spec.whatwg.org/#isomorphic-decode">https://infra.spec.whatwg.org/#isomorphic-decode</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-isomorphic-decode">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-list-item">
   <a href="https://infra.spec.whatwg.org/#list-item">https://infra.spec.whatwg.org/#list-item</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-item">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-string-length">
   <a href="https://infra.spec.whatwg.org/#string-length">https://infra.spec.whatwg.org/#string-length</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-string-length">4.2. URL miscellaneous</a> <a href="#ref-for-string-length①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-list">
   <a href="https://infra.spec.whatwg.org/#list">https://infra.spec.whatwg.org/#list</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list">3.1. Host representation</a>
    <li><a href="#ref-for-list①">4.1. URL representation</a>
    <li><a href="#ref-for-list②">5.1. application/x-www-form-urlencoded parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-noncharacter">
   <a href="https://infra.spec.whatwg.org/#noncharacter">https://infra.spec.whatwg.org/#noncharacter</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-noncharacter">4.3. URL writing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-list-remove">
   <a href="https://infra.spec.whatwg.org/#list-remove">https://infra.spec.whatwg.org/#list-remove</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-remove">4.2. URL miscellaneous</a>
    <li><a href="#ref-for-list-remove①">4.4. URL parsing</a> <a href="#ref-for-list-remove②">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-list-size">
   <a href="https://infra.spec.whatwg.org/#list-size">https://infra.spec.whatwg.org/#list-size</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-list-size">4.2. URL miscellaneous</a>
    <li><a href="#ref-for-list-size①">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-string">
   <a href="https://infra.spec.whatwg.org/#string">https://infra.spec.whatwg.org/#string</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-string">1.2. Parsers</a>
    <li><a href="#ref-for-string①">1.3. Percent-encoded bytes</a>
    <li><a href="#ref-for-string②">3.3. IDNA</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-surrogate">
   <a href="https://infra.spec.whatwg.org/#surrogate">https://infra.spec.whatwg.org/#surrogate</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-surrogate">4.3. URL writing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ToASCII">
   <a href="https://www.unicode.org/reports/tr46/#ToASCII">https://www.unicode.org/reports/tr46/#ToASCII</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ToASCII">3.3. IDNA</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-ToUnicode">
   <a href="https://www.unicode.org/reports/tr46/#ToUnicode">https://www.unicode.org/reports/tr46/#ToUnicode</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ToUnicode">3.3. IDNA</a>
    <li><a href="#ref-for-ToUnicode①">3.4. Host writing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-Exposed">
   <a href="https://heycam.github.io/webidl/#Exposed">https://heycam.github.io/webidl/#Exposed</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-Exposed">6.1. URL class</a>
    <li><a href="#ref-for-Exposed①">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-LegacyWindowAlias">
   <a href="https://heycam.github.io/webidl/#LegacyWindowAlias">https://heycam.github.io/webidl/#LegacyWindowAlias</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-LegacyWindowAlias">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-SameObject">
   <a href="https://heycam.github.io/webidl/#SameObject">https://heycam.github.io/webidl/#SameObject</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-SameObject">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-exceptiondef-typeerror">
   <a href="https://heycam.github.io/webidl/#exceptiondef-typeerror">https://heycam.github.io/webidl/#exceptiondef-typeerror</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-exceptiondef-typeerror">6.1. URL class</a> <a href="#ref-for-exceptiondef-typeerror①">(2)</a> <a href="#ref-for-exceptiondef-typeerror②">(3)</a>
    <li><a href="#ref-for-exceptiondef-typeerror③">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-USVString">
   <a href="https://heycam.github.io/webidl/#idl-USVString">https://heycam.github.io/webidl/#idl-USVString</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-USVString">6.1. URL class</a> <a href="#ref-for-idl-USVString①">(2)</a> <a href="#ref-for-idl-USVString②">(3)</a> <a href="#ref-for-idl-USVString③">(4)</a> <a href="#ref-for-idl-USVString④">(5)</a> <a href="#ref-for-idl-USVString⑤">(6)</a> <a href="#ref-for-idl-USVString⑥">(7)</a> <a href="#ref-for-idl-USVString⑦">(8)</a> <a href="#ref-for-idl-USVString⑧">(9)</a> <a href="#ref-for-idl-USVString⑨">(10)</a> <a href="#ref-for-idl-USVString①⓪">(11)</a> <a href="#ref-for-idl-USVString①①">(12)</a> <a href="#ref-for-idl-USVString①②">(13)</a> <a href="#ref-for-idl-USVString①③">(14)</a>
    <li><a href="#ref-for-idl-USVString①④">6.2. URLSearchParams class</a> <a href="#ref-for-idl-USVString①⑤">(2)</a> <a href="#ref-for-idl-USVString①⑥">(3)</a> <a href="#ref-for-idl-USVString①⑦">(4)</a> <a href="#ref-for-idl-USVString①⑧">(5)</a> <a href="#ref-for-idl-USVString①⑨">(6)</a> <a href="#ref-for-idl-USVString②⓪">(7)</a> <a href="#ref-for-idl-USVString②①">(8)</a> <a href="#ref-for-idl-USVString②②">(9)</a> <a href="#ref-for-idl-USVString②③">(10)</a> <a href="#ref-for-idl-USVString②④">(11)</a> <a href="#ref-for-idl-USVString②⑤">(12)</a> <a href="#ref-for-idl-USVString②⑥">(13)</a> <a href="#ref-for-idl-USVString②⑦">(14)</a> <a href="#ref-for-idl-USVString②⑧">(15)</a> <a href="#ref-for-idl-USVString②⑨">(16)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-boolean">
   <a href="https://heycam.github.io/webidl/#idl-boolean">https://heycam.github.io/webidl/#idl-boolean</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-boolean">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-record">
   <a href="https://heycam.github.io/webidl/#idl-record">https://heycam.github.io/webidl/#idl-record</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-record">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-idl-sequence">
   <a href="https://heycam.github.io/webidl/#idl-sequence">https://heycam.github.io/webidl/#idl-sequence</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-idl-sequence">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dfn-throw">
   <a href="https://heycam.github.io/webidl/#dfn-throw">https://heycam.github.io/webidl/#dfn-throw</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-throw">6.1. URL class</a> <a href="#ref-for-dfn-throw①">(2)</a> <a href="#ref-for-dfn-throw②">(3)</a>
    <li><a href="#ref-for-dfn-throw③">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-dfn-value-pairs-to-iterate-over">
   <a href="https://heycam.github.io/webidl/#dfn-value-pairs-to-iterate-over">https://heycam.github.io/webidl/#dfn-value-pairs-to-iterate-over</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dfn-value-pairs-to-iterate-over">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3>
  <ul class="index">
   <li>
    <a data-link-type="biblio">[DOM]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-context-object" style="color:initial">context object</span>
    </ul>
   <li>
    <a data-link-type="biblio">[ENCODING]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-encode" style="color:initial">encode</span>
     <li><span class="dfn-paneled" id="term-for-encoding" style="color:initial">encoding</span>
     <li><span class="dfn-paneled" id="term-for-get-an-output-encoding" style="color:initial">get an output encoding</span>
     <li><span class="dfn-paneled" id="term-for-utf-8" style="color:initial">utf-8</span>
     <li><span class="dfn-paneled" id="term-for-utf-8-decode-without-bom" style="color:initial">utf-8 decode without bom</span>
     <li><span class="dfn-paneled" id="term-for-utf-8-decode-without-bom-or-fail" style="color:initial">utf-8 decode without bom or fail</span>
     <li><span class="dfn-paneled" id="term-for-utf-8-encode" style="color:initial">utf-8 encode</span>
    </ul>
   <li>
    <a data-link-type="biblio">[FILEAPI]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-blob-url-entry" style="color:initial">blob url entry</span>
     <li><span class="dfn-paneled" id="term-for-BlobURLStore" style="color:initial">blob url store</span>
     <li><span class="dfn-paneled" id="term-for-blob-url-entry-environment" style="color:initial">environment</span>
     <li><span class="dfn-paneled" id="term-for-blob-url-resolve" style="color:initial">resolve</span>
    </ul>
   <li>
    <a data-link-type="biblio">[HTML]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-eventsource" style="color:initial">EventSource</span>
     <li><span class="dfn-paneled" id="term-for-hashchangeevent" style="color:initial">HashChangeEvent</span>
     <li><span class="dfn-paneled" id="term-for-location" style="color:initial">Location</span>
     <li><span class="dfn-paneled" id="term-for-concept-origin-opaque" style="color:initial">opaque origin</span>
     <li><span class="dfn-paneled" id="term-for-concept-settings-object-origin" style="color:initial">origin <small>(for environment settings object)</small></span>
     <li><span class="dfn-paneled" id="term-for-dom-location-protocol" style="color:initial">protocol</span>
     <li><span class="dfn-paneled" id="term-for-same-origin" style="color:initial">same origin</span>
     <li><span class="dfn-paneled" id="term-for-same-site" style="color:initial">same site</span>
     <li><span class="dfn-paneled" id="term-for-ascii-serialisation-of-an-origin" style="color:initial">serialization of an origin</span>
    </ul>
   <li>
    <a data-link-type="biblio">[INFRA]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-list-append" style="color:initial">append</span>
     <li><span class="dfn-paneled" id="term-for-ascii-alpha" style="color:initial">ascii alpha</span>
     <li><span class="dfn-paneled" id="term-for-ascii-alphanumeric" style="color:initial">ascii alphanumeric</span>
     <li><span class="dfn-paneled" id="term-for-ascii-byte" style="color:initial">ascii byte</span>
     <li><span class="dfn-paneled" id="term-for-ascii-case-insensitive" style="color:initial">ascii case-insensitive</span>
     <li><span class="dfn-paneled" id="term-for-ascii-digit" style="color:initial">ascii digit</span>
     <li><span class="dfn-paneled" id="term-for-ascii-hex-digit" style="color:initial">ascii hex digit</span>
     <li><span class="dfn-paneled" id="term-for-ascii-lowercase" style="color:initial">ascii lowercase</span>
     <li><span class="dfn-paneled" id="term-for-ascii-string" style="color:initial">ascii string</span>
     <li><span class="dfn-paneled" id="term-for-ascii-tab-or-newline" style="color:initial">ascii tab or newline</span>
     <li><span class="dfn-paneled" id="term-for-ascii-upper-hex-digit" style="color:initial">ascii upper hex digit</span>
     <li><span class="dfn-paneled" id="term-for-iteration-break" style="color:initial">break</span>
     <li><span class="dfn-paneled" id="term-for-byte-sequence" style="color:initial">byte sequence</span>
     <li><span class="dfn-paneled" id="term-for-c0-control" style="color:initial">c0 control</span>
     <li><span class="dfn-paneled" id="term-for-c0-control-or-space" style="color:initial">c0 control or space</span>
     <li><span class="dfn-paneled" id="term-for-code-point" style="color:initial">code point</span>
     <li><span class="dfn-paneled" id="term-for-iteration-continue" style="color:initial">continue</span>
     <li><span class="dfn-paneled" id="term-for-map-iterate" style="color:initial">for each <small>(for map)</small></span>
     <li><span class="dfn-paneled" id="term-for-list-is-empty" style="color:initial">is empty</span>
     <li><span class="dfn-paneled" id="term-for-isomorphic-decode" style="color:initial">isomorphic decode</span>
     <li><span class="dfn-paneled" id="term-for-list-item" style="color:initial">item</span>
     <li><span class="dfn-paneled" id="term-for-string-length" style="color:initial">length</span>
     <li><span class="dfn-paneled" id="term-for-list" style="color:initial">list</span>
     <li><span class="dfn-paneled" id="term-for-noncharacter" style="color:initial">noncharacter</span>
     <li><span class="dfn-paneled" id="term-for-list-remove" style="color:initial">remove</span>
     <li><span class="dfn-paneled" id="term-for-list-size" style="color:initial">size</span>
     <li><span class="dfn-paneled" id="term-for-string" style="color:initial">string</span>
     <li><span class="dfn-paneled" id="term-for-surrogate" style="color:initial">surrogate</span>
    </ul>
   <li>
    <a data-link-type="biblio">[UTS46]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-ToASCII" style="color:initial">ToASCII</span>
     <li><span class="dfn-paneled" id="term-for-ToUnicode" style="color:initial">ToUnicode</span>
    </ul>
   <li>
    <a data-link-type="biblio">[WEBIDL]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-Exposed" style="color:initial">Exposed</span>
     <li><span class="dfn-paneled" id="term-for-LegacyWindowAlias" style="color:initial">LegacyWindowAlias</span>
     <li><span class="dfn-paneled" id="term-for-SameObject" style="color:initial">SameObject</span>
     <li><span class="dfn-paneled" id="term-for-exceptiondef-typeerror" style="color:initial">TypeError</span>
     <li><span class="dfn-paneled" id="term-for-idl-USVString" style="color:initial">USVString</span>
     <li><span class="dfn-paneled" id="term-for-idl-boolean" style="color:initial">boolean</span>
     <li><span class="dfn-paneled" id="term-for-idl-record" style="color:initial">record</span>
     <li><span class="dfn-paneled" id="term-for-idl-sequence" style="color:initial">sequence</span>
     <li><span class="dfn-paneled" id="term-for-dfn-throw" style="color:initial">throw</span>
     <li><span class="dfn-paneled" id="term-for-dfn-value-pairs-to-iterate-over" style="color:initial">value pairs to iterate over</span>
    </ul>
  </ul>
  <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2>
  <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3>
  <dl>
   <dt id="biblio-bidi">[BIDI]
   <dd>Mark Davis; Aharon Lanin; Andrew Glass. <a href="https://www.unicode.org/reports/tr9/tr9-41.html">Unicode Bidirectional Algorithm</a>. 4 February 2019. Unicode Standard Annex #9. URL: <a href="https://www.unicode.org/reports/tr9/tr9-41.html">https://www.unicode.org/reports/tr9/tr9-41.html</a>
   <dt id="biblio-dom">[DOM]
   <dd>Anne van Kesteren. <a href="https://dom.spec.whatwg.org/">DOM Standard</a>. Living Standard. URL: <a href="https://dom.spec.whatwg.org/">https://dom.spec.whatwg.org/</a>
   <dt id="biblio-encoding">[ENCODING]
   <dd>Anne van Kesteren. <a href="https://encoding.spec.whatwg.org/">Encoding Standard</a>. Living Standard. URL: <a href="https://encoding.spec.whatwg.org/">https://encoding.spec.whatwg.org/</a>
   <dt id="biblio-fileapi">[FILEAPI]
   <dd>Marijn Kruisselbrink; Arun Ranganathan. <a href="https://w3c.github.io/FileAPI/">File API</a>. URL: <a href="https://w3c.github.io/FileAPI/">https://w3c.github.io/FileAPI/</a>
   <dt id="biblio-html">[HTML]
   <dd>Anne van Kesteren; et al. <a href="https://html.spec.whatwg.org/multipage/">HTML Standard</a>. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a>
   <dt id="biblio-iana-uri-schemes">[IANA-URI-SCHEMES]
   <dd><a href="https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml">Uniform Resource Identifier (URI) Schemes</a>. URL: <a href="https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml">https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml</a>
   <dt id="biblio-infra">[INFRA]
   <dd>Anne van Kesteren; Domenic Denicola. <a href="https://infra.spec.whatwg.org/">Infra Standard</a>. Living Standard. URL: <a href="https://infra.spec.whatwg.org/">https://infra.spec.whatwg.org/</a>
   <dt id="biblio-media-source">[MEDIA-SOURCE]
   <dd>Matthew Wolenetz; et al. <a href="https://w3c.github.io/media-source/">Media Source Extensions™</a>. URL: <a href="https://w3c.github.io/media-source/">https://w3c.github.io/media-source/</a>
   <dt id="biblio-psl">[PSL]
   <dd><cite><a href="https://publicsuffix.org/">Public Suffix List</a></cite>.    Mozilla Foundation.
   <dt id="biblio-rfc4291">[RFC4291]
   <dd>R. Hinden; S. Deering. <a href="https://tools.ietf.org/html/rfc4291">IP Version 6 Addressing Architecture</a>. February 2006. Draft Standard. URL: <a href="https://tools.ietf.org/html/rfc4291">https://tools.ietf.org/html/rfc4291</a>
   <dt id="biblio-uts46">[UTS46]
   <dd>Mark Davis; Michel Suignard. <a href="https://www.unicode.org/reports/tr46/tr46-24.html">Unicode IDNA Compatibility Processing</a>. 26 April 2019. Unicode Technical Standard #46. URL: <a href="https://www.unicode.org/reports/tr46/tr46-24.html">https://www.unicode.org/reports/tr46/tr46-24.html</a>
   <dt id="biblio-webidl">[WEBIDL]
   <dd>Boris Zbarsky. <a href="https://heycam.github.io/webidl/">Web IDL</a>. URL: <a href="https://heycam.github.io/webidl/">https://heycam.github.io/webidl/</a>
  </dl>
  <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3>
  <dl>
   <dt id="biblio-idnfaq">[IDNFAQ]
   <dd><a href="https://unicode.org/faq/idn.html">Internationalized Domain Names (IDN) FAQ</a>. URL: <a href="https://unicode.org/faq/idn.html">https://unicode.org/faq/idn.html</a>
   <dt id="biblio-rfc1034">[RFC1034]
   <dd>P.V. Mockapetris. <a href="https://tools.ietf.org/html/rfc1034">Domain names - concepts and facilities</a>. November 1987. Internet Standard. URL: <a href="https://tools.ietf.org/html/rfc1034">https://tools.ietf.org/html/rfc1034</a>
   <dt id="biblio-rfc3986">[RFC3986]
   <dd>T. Berners-Lee; R. Fielding; L. Masinter. <a href="https://tools.ietf.org/html/rfc3986">Uniform Resource Identifier (URI): Generic Syntax</a>. January 2005. Internet Standard. URL: <a href="https://tools.ietf.org/html/rfc3986">https://tools.ietf.org/html/rfc3986</a>
   <dt id="biblio-rfc3987">[RFC3987]
   <dd>M. Duerst; M. Suignard. <a href="https://tools.ietf.org/html/rfc3987">Internationalized Resource Identifiers (IRIs)</a>. January 2005. Proposed Standard. URL: <a href="https://tools.ietf.org/html/rfc3987">https://tools.ietf.org/html/rfc3987</a>
   <dt id="biblio-rfc5952">[RFC5952]
   <dd>S. Kawamura; M. Kawashima. <a href="https://tools.ietf.org/html/rfc5952">A Recommendation for IPv6 Address Text Representation</a>. August 2010. Proposed Standard. URL: <a href="https://tools.ietf.org/html/rfc5952">https://tools.ietf.org/html/rfc5952</a>
   <dt id="biblio-rfc6454">[RFC6454]
   <dd>A. Barth. <a href="https://tools.ietf.org/html/rfc6454">The Web Origin Concept</a>. December 2011. Proposed Standard. URL: <a href="https://tools.ietf.org/html/rfc6454">https://tools.ietf.org/html/rfc6454</a>
   <dt id="biblio-rfc7595">[RFC7595]
   <dd>D. Thaler, Ed.; T. Hansen; T. Hardie. <a href="https://tools.ietf.org/html/rfc7595">Guidelines and Registration Procedures for URI Schemes</a>. June 2015. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc7595">https://tools.ietf.org/html/rfc7595</a>
   <dt id="biblio-rfc791">[RFC791]
   <dd>J. Postel. <a href="https://tools.ietf.org/html/rfc791">Internet Protocol</a>. September 1981. Internet Standard. URL: <a href="https://tools.ietf.org/html/rfc791">https://tools.ietf.org/html/rfc791</a>
   <dt id="biblio-utr36">[UTR36]
   <dd>Mark Davis; Michel Suignard. <a href="https://www.unicode.org/reports/tr36/tr36-15.html">Unicode Security Considerations</a>. 19 September 2014. Unicode Technical Report #36. URL: <a href="https://www.unicode.org/reports/tr36/tr36-15.html">https://www.unicode.org/reports/tr36/tr36-15.html</a>
   <dt id="biblio-uts39">[UTS39]
   <dd>Mark Davis; Michel Suignard. <a href="https://www.unicode.org/reports/tr39/tr39-20.html">Unicode Security Mechanisms</a>. 6 May 2019. Unicode Technical Standard #39. URL: <a href="https://www.unicode.org/reports/tr39/tr39-20.html">https://www.unicode.org/reports/tr39/tr39-20.html</a>
  </dl>
  <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">IDL Index</span><a class="self-link" href="#idl-index"></a></h2>
<pre class="idl highlight def">[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed②"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>Worker</c->),
 <a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#LegacyWindowAlias" id="ref-for-LegacyWindowAlias①"><c- g>LegacyWindowAlias</c-></a>=<a href="#webkiturl"><code><c- n>webkitURL</c-></code></a>]
<c- b>interface</c-> <a href="#url"><code><c- g>URL</c-></code></a> {
  <a class="idl-code" data-link-type="constructor" href="#dom-url-url" id="ref-for-dom-url-url①"><c- g>constructor</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString③⓪"><c- b>USVString</c-></a> <a href="#dom-url-url-url-base-url"><code><c- g>url</c-></code></a>, <c- b>optional</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①①⓪"><c- b>USVString</c-></a> <a href="#dom-url-url-url-base-base"><code><c- g>base</c-></code></a>);

  <a href="#URL-stringification-behavior"><c- b>stringifier</c-></a> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②①⓪"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-href" id="ref-for-dom-url-href③"><c- g>href</c-></a>;
  <c- b>readonly</c-> <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString③①"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="USVString" href="#dom-url-origin" id="ref-for-dom-url-origin①"><c- g>origin</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString④①"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-protocol" id="ref-for-dom-url-protocol②"><c- g>protocol</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString⑤①"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-username" id="ref-for-dom-url-username②"><c- g>username</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString⑥①"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-password" id="ref-for-dom-url-password②"><c- g>password</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString⑦①"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-host" id="ref-for-dom-url-host③"><c- g>host</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString⑧①"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-hostname" id="ref-for-dom-url-hostname②"><c- g>hostname</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString⑨①"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-port" id="ref-for-dom-url-port②"><c- g>port</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①⓪①"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-pathname" id="ref-for-dom-url-pathname②"><c- g>pathname</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①①①"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-search" id="ref-for-dom-url-search②"><c- g>search</c-></a>;
  [<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#SameObject" id="ref-for-SameObject①"><c- g>SameObject</c-></a>] <c- b>readonly</c-> <c- b>attribute</c-> <a class="n" data-link-type="idl-name" href="#urlsearchparams" id="ref-for-urlsearchparams①④"><c- n>URLSearchParams</c-></a> <a class="idl-code" data-link-type="attribute" data-readonly data-type="URLSearchParams" href="#dom-url-searchparams" id="ref-for-dom-url-searchparams①"><c- g>searchParams</c-></a>;
           <c- b>attribute</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①②①"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="attribute" data-type="USVString" href="#dom-url-hash" id="ref-for-dom-url-hash②"><c- g>hash</c-></a>;

  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①③①"><c- b>USVString</c-></a> <a class="idl-code" data-link-type="method" href="#dom-url-tojson" id="ref-for-dom-url-tojson①"><c- g>toJSON</c-></a>();
};

[<a class="idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#Exposed" id="ref-for-Exposed①①"><c- g>Exposed</c-></a>=(<c- n>Window</c->,<c- n>Worker</c->)]
<c- b>interface</c-> <a href="#urlsearchparams"><code><c- g>URLSearchParams</c-></code></a> {
  <a class="idl-code" data-link-type="constructor" href="#dom-urlsearchparams-urlsearchparams" id="ref-for-dom-urlsearchparams-urlsearchparams①"><c- g>constructor</c-></a>(<c- b>optional</c-> (<c- b>sequence</c->&lt;<c- b>sequence</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①④①"><c- b>USVString</c-></a>>> <c- b>or</c-> <c- b>record</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①⑤①"><c- b>USVString</c-></a>, <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①⑥①"><c- b>USVString</c-></a>> <c- b>or</c-> <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①⑦①"><c- b>USVString</c-></a>) <a href="#dom-urlsearchparams-urlsearchparams-init-init"><code><c- g>init</c-></code></a> = "");

  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dom-urlsearchparams-append" id="ref-for-dom-urlsearchparams-append①"><c- g>append</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①⑧①"><c- b>USVString</c-></a> <a href="#dom-urlsearchparams-append-name-value-name"><code><c- g>name</c-></code></a>, <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString①⑨①"><c- b>USVString</c-></a> <a href="#dom-urlsearchparams-append-name-value-value"><code><c- g>value</c-></code></a>);
  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dom-urlsearchparams-delete" id="ref-for-dom-urlsearchparams-delete①"><c- g>delete</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②⓪①"><c- b>USVString</c-></a> <a href="#dom-urlsearchparams-delete-name-name"><code><c- g>name</c-></code></a>);
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②①①"><c- b>USVString</c-></a>? <a class="idl-code" data-link-type="method" href="#dom-urlsearchparams-get" id="ref-for-dom-urlsearchparams-get①"><c- g>get</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②②①"><c- b>USVString</c-></a> <a href="#dom-urlsearchparams-get-name-name"><code><c- g>name</c-></code></a>);
  <c- b>sequence</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②③①"><c- b>USVString</c-></a>> <a class="idl-code" data-link-type="method" href="#dom-urlsearchparams-getall" id="ref-for-dom-urlsearchparams-getall①"><c- g>getAll</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②④①"><c- b>USVString</c-></a> <a href="#dom-urlsearchparams-getall-name-name"><code><c- g>name</c-></code></a>);
  <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-boolean" id="ref-for-idl-boolean①"><c- b>boolean</c-></a> <a class="idl-code" data-link-type="method" href="#dom-urlsearchparams-has" id="ref-for-dom-urlsearchparams-has①"><c- g>has</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②⑤①"><c- b>USVString</c-></a> <a href="#dom-urlsearchparams-has-name-name"><code><c- g>name</c-></code></a>);
  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dom-urlsearchparams-set" id="ref-for-dom-urlsearchparams-set①"><c- g>set</c-></a>(<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②⑥①"><c- b>USVString</c-></a> <a href="#dom-urlsearchparams-set-name-value-name"><code><c- g>name</c-></code></a>, <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②⑦①"><c- b>USVString</c-></a> <a href="#dom-urlsearchparams-set-name-value-value"><code><c- g>value</c-></code></a>);

  <c- b>void</c-> <a class="idl-code" data-link-type="method" href="#dom-urlsearchparams-sort" id="ref-for-dom-urlsearchparams-sort②"><c- g>sort</c-></a>();

  <c- b>iterable</c->&lt;<a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②⑧①"><c- b>USVString</c-></a>, <a class="idl-code" data-link-type="interface" href="https://heycam.github.io/webidl/#idl-USVString" id="ref-for-idl-USVString②⑨①"><c- b>USVString</c-></a>>;
  <a data-link-type="dfn" href="#urlsearchparams-stringification-behavior" id="ref-for-urlsearchparams-stringification-behavior①"><c- b>stringifier</c-></a>;
};

</pre>
  <aside class="dfn-panel" data-for="serialize-an-integer">
   <b><a href="#serialize-an-integer">#serialize-an-integer</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-serialize-an-integer">3.6. Host serializing</a>
    <li><a href="#ref-for-serialize-an-integer①">4.5. URL serializing</a>
    <li><a href="#ref-for-serialize-an-integer②">6.1. URL class</a> <a href="#ref-for-serialize-an-integer③">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="validation-error">
   <b><a href="#validation-error">#validation-error</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-validation-error">1.1. Writing</a> <a href="#ref-for-validation-error①">(2)</a>
    <li><a href="#ref-for-validation-error②">3. Hosts (domains and IP addresses)</a>
    <li><a href="#ref-for-validation-error③">3.3. IDNA</a> <a href="#ref-for-validation-error④">(2)</a>
    <li><a href="#ref-for-validation-error⑤">3.5. Host parsing</a> <a href="#ref-for-validation-error⑥">(2)</a> <a href="#ref-for-validation-error⑦">(3)</a> <a href="#ref-for-validation-error⑧">(4)</a> <a href="#ref-for-validation-error⑨">(5)</a> <a href="#ref-for-validation-error①⓪">(6)</a> <a href="#ref-for-validation-error①①">(7)</a> <a href="#ref-for-validation-error①②">(8)</a> <a href="#ref-for-validation-error①③">(9)</a> <a href="#ref-for-validation-error①④">(10)</a> <a href="#ref-for-validation-error①⑤">(11)</a> <a href="#ref-for-validation-error①⑥">(12)</a> <a href="#ref-for-validation-error①⑦">(13)</a> <a href="#ref-for-validation-error①⑧">(14)</a> <a href="#ref-for-validation-error①⑨">(15)</a> <a href="#ref-for-validation-error②⓪">(16)</a> <a href="#ref-for-validation-error②①">(17)</a> <a href="#ref-for-validation-error②②">(18)</a> <a href="#ref-for-validation-error②③">(19)</a> <a href="#ref-for-validation-error②④">(20)</a>
    <li><a href="#ref-for-validation-error②⑤">4. URLs</a>
    <li><a href="#ref-for-validation-error②⑥">4.4. URL parsing</a> <a href="#ref-for-validation-error②⑦">(2)</a> <a href="#ref-for-validation-error②⑧">(3)</a> <a href="#ref-for-validation-error②⑨">(4)</a> <a href="#ref-for-validation-error③⓪">(5)</a> <a href="#ref-for-validation-error③①">(6)</a> <a href="#ref-for-validation-error③②">(7)</a> <a href="#ref-for-validation-error③③">(8)</a> <a href="#ref-for-validation-error③④">(9)</a> <a href="#ref-for-validation-error③⑤">(10)</a> <a href="#ref-for-validation-error③⑥">(11)</a> <a href="#ref-for-validation-error③⑦">(12)</a> <a href="#ref-for-validation-error③⑧">(13)</a> <a href="#ref-for-validation-error③⑨">(14)</a> <a href="#ref-for-validation-error④⓪">(15)</a> <a href="#ref-for-validation-error④①">(16)</a> <a href="#ref-for-validation-error④②">(17)</a> <a href="#ref-for-validation-error④③">(18)</a> <a href="#ref-for-validation-error④④">(19)</a> <a href="#ref-for-validation-error④⑤">(20)</a> <a href="#ref-for-validation-error④⑥">(21)</a> <a href="#ref-for-validation-error④⑦">(22)</a> <a href="#ref-for-validation-error④⑧">(23)</a> <a href="#ref-for-validation-error④⑨">(24)</a> <a href="#ref-for-validation-error⑤⓪">(25)</a> <a href="#ref-for-validation-error⑤①">(26)</a> <a href="#ref-for-validation-error⑤②">(27)</a> <a href="#ref-for-validation-error⑤③">(28)</a> <a href="#ref-for-validation-error⑤④">(29)</a> <a href="#ref-for-validation-error⑤⑤">(30)</a> <a href="#ref-for-validation-error⑤⑥">(31)</a> <a href="#ref-for-validation-error⑤⑦">(32)</a> <a href="#ref-for-validation-error⑤⑧">(33)</a> <a href="#ref-for-validation-error⑤⑨">(34)</a> <a href="#ref-for-validation-error⑥⓪">(35)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="eof-code-point">
   <b><a href="#eof-code-point">#eof-code-point</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-eof-code-point">3.5. Host parsing</a> <a href="#ref-for-eof-code-point①">(2)</a> <a href="#ref-for-eof-code-point②">(3)</a> <a href="#ref-for-eof-code-point③">(4)</a>
    <li><a href="#ref-for-eof-code-point④">4.4. URL parsing</a> <a href="#ref-for-eof-code-point⑤">(2)</a> <a href="#ref-for-eof-code-point⑥">(3)</a> <a href="#ref-for-eof-code-point⑦">(4)</a> <a href="#ref-for-eof-code-point⑧">(5)</a> <a href="#ref-for-eof-code-point⑨">(6)</a> <a href="#ref-for-eof-code-point①⓪">(7)</a> <a href="#ref-for-eof-code-point①①">(8)</a> <a href="#ref-for-eof-code-point①②">(9)</a> <a href="#ref-for-eof-code-point①③">(10)</a> <a href="#ref-for-eof-code-point①④">(11)</a> <a href="#ref-for-eof-code-point①⑤">(12)</a> <a href="#ref-for-eof-code-point①⑥">(13)</a> <a href="#ref-for-eof-code-point①⑦">(14)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="c">
   <b><a href="#c">#c</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-c">1.2. Parsers</a>
    <li><a href="#ref-for-c①">3.5. Host parsing</a> <a href="#ref-for-c②">(2)</a> <a href="#ref-for-c③">(3)</a> <a href="#ref-for-c④">(4)</a> <a href="#ref-for-c⑤">(5)</a> <a href="#ref-for-c⑥">(6)</a> <a href="#ref-for-c⑦">(7)</a> <a href="#ref-for-c⑧">(8)</a> <a href="#ref-for-c⑨">(9)</a> <a href="#ref-for-c①⓪">(10)</a> <a href="#ref-for-c①①">(11)</a> <a href="#ref-for-c①②">(12)</a> <a href="#ref-for-c①③">(13)</a> <a href="#ref-for-c①④">(14)</a>
    <li><a href="#ref-for-c①⑤">4.4. URL parsing</a> <a href="#ref-for-c①⑥">(2)</a> <a href="#ref-for-c①⑦">(3)</a> <a href="#ref-for-c①⑧">(4)</a> <a href="#ref-for-c①⑨">(5)</a> <a href="#ref-for-c②⓪">(6)</a> <a href="#ref-for-c②①">(7)</a> <a href="#ref-for-c②②">(8)</a> <a href="#ref-for-c②③">(9)</a> <a href="#ref-for-c②④">(10)</a> <a href="#ref-for-c②⑤">(11)</a> <a href="#ref-for-c②⑥">(12)</a> <a href="#ref-for-c②⑦">(13)</a> <a href="#ref-for-c②⑧">(14)</a> <a href="#ref-for-c②⑨">(15)</a> <a href="#ref-for-c③⓪">(16)</a> <a href="#ref-for-c③①">(17)</a> <a href="#ref-for-c③②">(18)</a> <a href="#ref-for-c③③">(19)</a> <a href="#ref-for-c③④">(20)</a> <a href="#ref-for-c③⑤">(21)</a> <a href="#ref-for-c③⑥">(22)</a> <a href="#ref-for-c③⑦">(23)</a> <a href="#ref-for-c③⑧">(24)</a> <a href="#ref-for-c③⑨">(25)</a> <a href="#ref-for-c④⓪">(26)</a> <a href="#ref-for-c④①">(27)</a> <a href="#ref-for-c④②">(28)</a> <a href="#ref-for-c④③">(29)</a> <a href="#ref-for-c④④">(30)</a> <a href="#ref-for-c④⑤">(31)</a> <a href="#ref-for-c④⑥">(32)</a> <a href="#ref-for-c④⑦">(33)</a> <a href="#ref-for-c④⑧">(34)</a> <a href="#ref-for-c④⑨">(35)</a> <a href="#ref-for-c⑤⓪">(36)</a> <a href="#ref-for-c⑤①">(37)</a> <a href="#ref-for-c⑤②">(38)</a> <a href="#ref-for-c⑤③">(39)</a> <a href="#ref-for-c⑤④">(40)</a> <a href="#ref-for-c⑤⑤">(41)</a> <a href="#ref-for-c⑤⑥">(42)</a> <a href="#ref-for-c⑤⑦">(43)</a> <a href="#ref-for-c⑤⑧">(44)</a> <a href="#ref-for-c⑤⑨">(45)</a> <a href="#ref-for-c⑥⓪">(46)</a> <a href="#ref-for-c⑥①">(47)</a> <a href="#ref-for-c⑥②">(48)</a> <a href="#ref-for-c⑥③">(49)</a> <a href="#ref-for-c⑥④">(50)</a> <a href="#ref-for-c⑥⑤">(51)</a> <a href="#ref-for-c⑥⑥">(52)</a> <a href="#ref-for-c⑥⑦">(53)</a> <a href="#ref-for-c⑥⑧">(54)</a> <a href="#ref-for-c⑥⑨">(55)</a> <a href="#ref-for-c⑦⓪">(56)</a> <a href="#ref-for-c⑦①">(57)</a> <a href="#ref-for-c⑦②">(58)</a> <a href="#ref-for-c⑦③">(59)</a> <a href="#ref-for-c⑦④">(60)</a> <a href="#ref-for-c⑦⑤">(61)</a> <a href="#ref-for-c⑦⑥">(62)</a> <a href="#ref-for-c⑦⑦">(63)</a> <a href="#ref-for-c⑦⑧">(64)</a> <a href="#ref-for-c⑦⑨">(65)</a> <a href="#ref-for-c⑧⓪">(66)</a> <a href="#ref-for-c⑧①">(67)</a> <a href="#ref-for-c⑧②">(68)</a> <a href="#ref-for-c⑧③">(69)</a> <a href="#ref-for-c⑧④">(70)</a> <a href="#ref-for-c⑧⑤">(71)</a> <a href="#ref-for-c⑧⑥">(72)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="remaining">
   <b><a href="#remaining">#remaining</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-remaining">1.2. Parsers</a>
    <li><a href="#ref-for-remaining①">3.5. Host parsing</a>
    <li><a href="#ref-for-remaining②">4.4. URL parsing</a> <a href="#ref-for-remaining③">(2)</a> <a href="#ref-for-remaining④">(3)</a> <a href="#ref-for-remaining⑤">(4)</a> <a href="#ref-for-remaining⑥">(5)</a> <a href="#ref-for-remaining⑦">(6)</a> <a href="#ref-for-remaining⑧">(7)</a> <a href="#ref-for-remaining⑨">(8)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="percent-encoded-byte">
   <b><a href="#percent-encoded-byte">#percent-encoded-byte</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-percent-encoded-byte">1.3. Percent-encoded bytes</a> <a href="#ref-for-percent-encoded-byte①">(2)</a>
    <li><a href="#ref-for-percent-encoded-byte②">4.3. URL writing</a> <a href="#ref-for-percent-encoded-byte③">(2)</a> <a href="#ref-for-percent-encoded-byte④">(3)</a> <a href="#ref-for-percent-encoded-byte⑤">(4)</a>
    <li><a href="#ref-for-percent-encoded-byte⑥">4.8.3. Internationalization and special characters</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="percent-encode">
   <b><a href="#percent-encode">#percent-encode</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-percent-encode">1.3. Percent-encoded bytes</a>
    <li><a href="#ref-for-percent-encode①">4.4. URL parsing</a>
    <li><a href="#ref-for-percent-encode②">5.2. application/x-www-form-urlencoded serializing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="percent-decode">
   <b><a href="#percent-decode">#percent-decode</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-percent-decode">1.3. Percent-encoded bytes</a>
    <li><a href="#ref-for-percent-decode①">4.8.3. Internationalization and special characters</a>
    <li><a href="#ref-for-percent-decode②">5.1. application/x-www-form-urlencoded parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="string-percent-decode">
   <b><a href="#string-percent-decode">#string-percent-decode</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-string-percent-decode">3.5. Host parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="c0-control-percent-encode-set">
   <b><a href="#c0-control-percent-encode-set">#c0-control-percent-encode-set</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-c0-control-percent-encode-set">1.3. Percent-encoded bytes</a>
    <li><a href="#ref-for-c0-control-percent-encode-set①">3.5. Host parsing</a>
    <li><a href="#ref-for-c0-control-percent-encode-set②">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="fragment-percent-encode-set">
   <b><a href="#fragment-percent-encode-set">#fragment-percent-encode-set</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-fragment-percent-encode-set">1.3. Percent-encoded bytes</a>
    <li><a href="#ref-for-fragment-percent-encode-set①">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="path-percent-encode-set">
   <b><a href="#path-percent-encode-set">#path-percent-encode-set</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-path-percent-encode-set">1.3. Percent-encoded bytes</a>
    <li><a href="#ref-for-path-percent-encode-set①">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="userinfo-percent-encode-set">
   <b><a href="#userinfo-percent-encode-set">#userinfo-percent-encode-set</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-userinfo-percent-encode-set">4.4. URL parsing</a> <a href="#ref-for-userinfo-percent-encode-set①">(2)</a> <a href="#ref-for-userinfo-percent-encode-set②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="utf-8-percent-encode">
   <b><a href="#utf-8-percent-encode">#utf-8-percent-encode</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-utf-8-percent-encode">3.5. Host parsing</a>
    <li><a href="#ref-for-utf-8-percent-encode①">4.4. URL parsing</a> <a href="#ref-for-utf-8-percent-encode②">(2)</a> <a href="#ref-for-utf-8-percent-encode③">(3)</a> <a href="#ref-for-utf-8-percent-encode④">(4)</a> <a href="#ref-for-utf-8-percent-encode⑤">(5)</a> <a href="#ref-for-utf-8-percent-encode⑥">(6)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-host">
   <b><a href="#concept-host">#concept-host</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-host">2. Security considerations</a>
    <li><a href="#ref-for-concept-host①">3. Hosts (domains and IP addresses)</a> <a href="#ref-for-concept-host②">(2)</a> <a href="#ref-for-concept-host③">(3)</a> <a href="#ref-for-concept-host④">(4)</a> <a href="#ref-for-concept-host⑤">(5)</a>
    <li><a href="#ref-for-concept-host⑥">3.1. Host representation</a> <a href="#ref-for-concept-host⑦">(2)</a>
    <li><a href="#ref-for-concept-host⑧">3.2. Host miscellaneous</a> <a href="#ref-for-concept-host⑨">(2)</a> <a href="#ref-for-concept-host①⓪">(3)</a>
    <li><a href="#ref-for-concept-host①①">3.6. Host serializing</a>
    <li><a href="#ref-for-concept-host①②">3.7. Host equivalence</a>
    <li><a href="#ref-for-concept-host①③">4.1. URL representation</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-domain">
   <b><a href="#concept-domain">#concept-domain</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-domain">3.1. Host representation</a> <a href="#ref-for-concept-domain①">(2)</a>
    <li><a href="#ref-for-concept-domain②">3.2. Host miscellaneous</a> <a href="#ref-for-concept-domain③">(2)</a>
    <li><a href="#ref-for-concept-domain④">3.3. IDNA</a>
    <li><a href="#ref-for-concept-domain⑤">3.5. Host parsing</a>
    <li><a href="#ref-for-concept-domain⑥">3.6. Host serializing</a>
    <li><a href="#ref-for-concept-domain⑦">4.1. URL representation</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-ipv4">
   <b><a href="#concept-ipv4">#concept-ipv4</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-ipv4">3.1. Host representation</a>
    <li><a href="#ref-for-concept-ipv4①">3.5. Host parsing</a> <a href="#ref-for-concept-ipv4②">(2)</a>
    <li><a href="#ref-for-concept-ipv4③">3.6. Host serializing</a> <a href="#ref-for-concept-ipv4④">(2)</a>
    <li><a href="#ref-for-concept-ipv4⑤">4.1. URL representation</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-ipv6">
   <b><a href="#concept-ipv6">#concept-ipv6</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-ipv6">3.1. Host representation</a>
    <li><a href="#ref-for-concept-ipv6①">3.5. Host parsing</a>
    <li><a href="#ref-for-concept-ipv6②">3.6. Host serializing</a> <a href="#ref-for-concept-ipv6③">(2)</a>
    <li><a href="#ref-for-concept-ipv6④">4.1. URL representation</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-ipv6-piece">
   <b><a href="#concept-ipv6-piece">#concept-ipv6-piece</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-ipv6-piece">3.5. Host parsing</a>
    <li><a href="#ref-for-concept-ipv6-piece①">3.6. Host serializing</a> <a href="#ref-for-concept-ipv6-piece②">(2)</a> <a href="#ref-for-concept-ipv6-piece③">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="opaque-host">
   <b><a href="#opaque-host">#opaque-host</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-opaque-host">3.1. Host representation</a>
    <li><a href="#ref-for-opaque-host①">3.6. Host serializing</a>
    <li><a href="#ref-for-opaque-host②">4.1. URL representation</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="empty-host">
   <b><a href="#empty-host">#empty-host</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-empty-host">3.1. Host representation</a>
    <li><a href="#ref-for-empty-host①">3.6. Host serializing</a>
    <li><a href="#ref-for-empty-host②">4.1. URL representation</a>
    <li><a href="#ref-for-empty-host③">4.3. URL writing</a> <a href="#ref-for-empty-host④">(2)</a>
    <li><a href="#ref-for-empty-host⑤">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="forbidden-host-code-point">
   <b><a href="#forbidden-host-code-point">#forbidden-host-code-point</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-forbidden-host-code-point">3.5. Host parsing</a> <a href="#ref-for-forbidden-host-code-point①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="host-public-suffix">
   <b><a href="#host-public-suffix">#host-public-suffix</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-host-public-suffix">3.2. Host miscellaneous</a> <a href="#ref-for-host-public-suffix①">(2)</a> <a href="#ref-for-host-public-suffix②">(3)</a> <a href="#ref-for-host-public-suffix③">(4)</a> <a href="#ref-for-host-public-suffix④">(5)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="host-registrable-domain">
   <b><a href="#host-registrable-domain">#host-registrable-domain</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-host-registrable-domain">3.2. Host miscellaneous</a> <a href="#ref-for-host-registrable-domain①">(2)</a> <a href="#ref-for-host-registrable-domain②">(3)</a>
    <li><a href="#ref-for-host-registrable-domain③">4.8.1. Simplify non-human-readable or irrelevant components</a>
    <li><a href="#ref-for-host-registrable-domain④">4.8.2. Elision</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-domain-to-ascii">
   <b><a href="#concept-domain-to-ascii">#concept-domain-to-ascii</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-domain-to-ascii">3.4. Host writing</a>
    <li><a href="#ref-for-concept-domain-to-ascii①">3.5. Host parsing</a> <a href="#ref-for-concept-domain-to-ascii②">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-domain-to-unicode">
   <b><a href="#concept-domain-to-unicode">#concept-domain-to-unicode</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-domain-to-unicode">4.8.3. Internationalization and special characters</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valid-host-string">
   <b><a href="#valid-host-string">#valid-host-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valid-host-string">3. Hosts (domains and IP addresses)</a> <a href="#ref-for-valid-host-string①">(2)</a>
    <li><a href="#ref-for-valid-host-string②">3.4. Host writing</a>
    <li><a href="#ref-for-valid-host-string③">4.3. URL writing</a> <a href="#ref-for-valid-host-string④">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valid-domain">
   <b><a href="#valid-domain">#valid-domain</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valid-domain">3.4. Host writing</a> <a href="#ref-for-valid-domain①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valid-domain-string">
   <b><a href="#valid-domain-string">#valid-domain-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valid-domain-string">3.4. Host writing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valid-ipv4-address-string">
   <b><a href="#valid-ipv4-address-string">#valid-ipv4-address-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valid-ipv4-address-string">3.4. Host writing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valid-ipv6-address-string">
   <b><a href="#valid-ipv6-address-string">#valid-ipv6-address-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valid-ipv6-address-string">3.4. Host writing</a> <a href="#ref-for-valid-ipv6-address-string①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valid-opaque-host-string">
   <b><a href="#valid-opaque-host-string">#valid-opaque-host-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valid-opaque-host-string">4.3. URL writing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-host-parser">
   <b><a href="#concept-host-parser">#concept-host-parser</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-host-parser">3. Hosts (domains and IP addresses)</a> <a href="#ref-for-concept-host-parser①">(2)</a> <a href="#ref-for-concept-host-parser②">(3)</a> <a href="#ref-for-concept-host-parser③">(4)</a>
    <li><a href="#ref-for-concept-host-parser④">4.4. URL parsing</a> <a href="#ref-for-concept-host-parser⑤">(2)</a> <a href="#ref-for-concept-host-parser⑥">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="ipv4-number-parser">
   <b><a href="#ipv4-number-parser">#ipv4-number-parser</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-ipv4-number-parser">3.5. Host parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-ipv4-parser">
   <b><a href="#concept-ipv4-parser">#concept-ipv4-parser</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-ipv4-parser">3.5. Host parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-ipv6-parser">
   <b><a href="#concept-ipv6-parser">#concept-ipv6-parser</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-ipv6-parser">3.5. Host parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-opaque-host-parser">
   <b><a href="#concept-opaque-host-parser">#concept-opaque-host-parser</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-opaque-host-parser">3.5. Host parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-host-serializer">
   <b><a href="#concept-host-serializer">#concept-host-serializer</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-host-serializer">3. Hosts (domains and IP addresses)</a> <a href="#ref-for-concept-host-serializer①">(2)</a> <a href="#ref-for-concept-host-serializer②">(3)</a>
    <li><a href="#ref-for-concept-host-serializer③">4.5. URL serializing</a>
    <li><a href="#ref-for-concept-host-serializer④">6.1. URL class</a> <a href="#ref-for-concept-host-serializer⑤">(2)</a> <a href="#ref-for-concept-host-serializer⑥">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-ipv4-serializer">
   <b><a href="#concept-ipv4-serializer">#concept-ipv4-serializer</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-ipv4-serializer">3.6. Host serializing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-ipv6-serializer">
   <b><a href="#concept-ipv6-serializer">#concept-ipv6-serializer</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-ipv6-serializer">3.6. Host serializing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-host-equals">
   <b><a href="#concept-host-equals">#concept-host-equals</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-host-equals">3. Hosts (domains and IP addresses)</a>
    <li><a href="#ref-for-concept-host-equals①">3.2. Host miscellaneous</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url">
   <b><a href="#concept-url">#concept-url</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url">2. Security considerations</a> <a href="#ref-for-concept-url①">(2)</a> <a href="#ref-for-concept-url②">(3)</a> <a href="#ref-for-concept-url③">(4)</a> <a href="#ref-for-concept-url④">(5)</a> <a href="#ref-for-concept-url⑤">(6)</a>
    <li><a href="#ref-for-concept-url⑥">3.1. Host representation</a>
    <li><a href="#ref-for-concept-url⑦">4. URLs</a> <a href="#ref-for-concept-url⑧">(2)</a> <a href="#ref-for-concept-url⑨">(3)</a> <a href="#ref-for-concept-url①⓪">(4)</a> <a href="#ref-for-concept-url①①">(5)</a> <a href="#ref-for-concept-url①②">(6)</a>
    <li><a href="#ref-for-concept-url①③">4.1. URL representation</a> <a href="#ref-for-concept-url①④">(2)</a> <a href="#ref-for-concept-url①⑤">(3)</a> <a href="#ref-for-concept-url①⑥">(4)</a> <a href="#ref-for-concept-url①⑦">(5)</a> <a href="#ref-for-concept-url①⑧">(6)</a> <a href="#ref-for-concept-url①⑨">(7)</a> <a href="#ref-for-concept-url②⓪">(8)</a> <a href="#ref-for-concept-url②①">(9)</a> <a href="#ref-for-concept-url②②">(10)</a> <a href="#ref-for-concept-url②③">(11)</a> <a href="#ref-for-concept-url②④">(12)</a> <a href="#ref-for-concept-url②⑤">(13)</a> <a href="#ref-for-concept-url②⑥">(14)</a> <a href="#ref-for-concept-url②⑦">(15)</a> <a href="#ref-for-concept-url②⑧">(16)</a> <a href="#ref-for-concept-url②⑨">(17)</a>
    <li><a href="#ref-for-concept-url③⓪">4.2. URL miscellaneous</a> <a href="#ref-for-concept-url③①">(2)</a> <a href="#ref-for-concept-url③②">(3)</a> <a href="#ref-for-concept-url③③">(4)</a> <a href="#ref-for-concept-url③④">(5)</a>
    <li><a href="#ref-for-concept-url③⑤">4.3. URL writing</a> <a href="#ref-for-concept-url③⑥">(2)</a>
    <li><a href="#ref-for-concept-url③⑦">4.4. URL parsing</a> <a href="#ref-for-concept-url③⑧">(2)</a> <a href="#ref-for-concept-url③⑨">(3)</a>
    <li><a href="#ref-for-concept-url④⓪">4.5. URL serializing</a>
    <li><a href="#ref-for-concept-url④①">4.6. URL equivalence</a>
    <li><a href="#ref-for-concept-url④②">4.7. Origin</a> <a href="#ref-for-concept-url④③">(2)</a> <a href="#ref-for-concept-url④④">(3)</a> <a href="#ref-for-concept-url④⑤">(4)</a> <a href="#ref-for-concept-url④⑥">(5)</a> <a href="#ref-for-concept-url④⑦">(6)</a> <a href="#ref-for-concept-url④⑧">(7)</a> <a href="#ref-for-concept-url④⑨">(8)</a> <a href="#ref-for-concept-url⑤⓪">(9)</a>
    <li><a href="#ref-for-concept-url⑤①">4.8. URL rendering</a>
    <li><a href="#ref-for-concept-url⑤②">4.8.1. Simplify non-human-readable or irrelevant components</a> <a href="#ref-for-concept-url⑤③">(2)</a>
    <li><a href="#ref-for-concept-url⑤④">4.8.3. Internationalization and special characters</a> <a href="#ref-for-concept-url⑤⑤">(2)</a> <a href="#ref-for-concept-url⑤⑥">(3)</a> <a href="#ref-for-concept-url⑤⑦">(4)</a> <a href="#ref-for-concept-url⑤⑧">(5)</a>
    <li><a href="#ref-for-concept-url⑤⑨">6.1. URL class</a> <a href="#ref-for-concept-url⑥⓪">(2)</a>
    <li><a href="#ref-for-concept-url⑥①">6.3. URL APIs elsewhere</a> <a href="#ref-for-concept-url⑥②">(2)</a> <a href="#ref-for-concept-url⑥③">(3)</a> <a href="#ref-for-concept-url⑥④">(4)</a> <a href="#ref-for-concept-url⑥⑤">(5)</a>
    <li><a href="#ref-for-concept-url⑥⑥">Acknowledgments</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url-scheme">
   <b><a href="#concept-url-scheme">#concept-url-scheme</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-scheme">4.1. URL representation</a> <a href="#ref-for-concept-url-scheme①">(2)</a>
    <li><a href="#ref-for-concept-url-scheme②">4.2. URL miscellaneous</a> <a href="#ref-for-concept-url-scheme③">(2)</a> <a href="#ref-for-concept-url-scheme④">(3)</a> <a href="#ref-for-concept-url-scheme⑤">(4)</a> <a href="#ref-for-concept-url-scheme⑥">(5)</a> <a href="#ref-for-concept-url-scheme⑦">(6)</a>
    <li><a href="#ref-for-concept-url-scheme⑧">4.3. URL writing</a>
    <li><a href="#ref-for-concept-url-scheme⑨">4.4. URL parsing</a> <a href="#ref-for-concept-url-scheme①⓪">(2)</a> <a href="#ref-for-concept-url-scheme①①">(3)</a> <a href="#ref-for-concept-url-scheme①②">(4)</a> <a href="#ref-for-concept-url-scheme①③">(5)</a> <a href="#ref-for-concept-url-scheme①④">(6)</a> <a href="#ref-for-concept-url-scheme①⑤">(7)</a> <a href="#ref-for-concept-url-scheme①⑥">(8)</a> <a href="#ref-for-concept-url-scheme①⑦">(9)</a> <a href="#ref-for-concept-url-scheme①⑧">(10)</a> <a href="#ref-for-concept-url-scheme①⑨">(11)</a> <a href="#ref-for-concept-url-scheme②⓪">(12)</a> <a href="#ref-for-concept-url-scheme②①">(13)</a> <a href="#ref-for-concept-url-scheme②②">(14)</a> <a href="#ref-for-concept-url-scheme②③">(15)</a> <a href="#ref-for-concept-url-scheme②④">(16)</a> <a href="#ref-for-concept-url-scheme②⑤">(17)</a> <a href="#ref-for-concept-url-scheme②⑥">(18)</a> <a href="#ref-for-concept-url-scheme②⑦">(19)</a> <a href="#ref-for-concept-url-scheme②⑧">(20)</a> <a href="#ref-for-concept-url-scheme②⑨">(21)</a> <a href="#ref-for-concept-url-scheme③⓪">(22)</a>
    <li><a href="#ref-for-concept-url-scheme③①">4.5. URL serializing</a> <a href="#ref-for-concept-url-scheme③②">(2)</a>
    <li><a href="#ref-for-concept-url-scheme③③">4.7. Origin</a> <a href="#ref-for-concept-url-scheme③④">(2)</a>
    <li><a href="#ref-for-concept-url-scheme③⑤">4.8.1. Simplify non-human-readable or irrelevant components</a>
    <li><a href="#ref-for-concept-url-scheme③⑥">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url-username">
   <b><a href="#concept-url-username">#concept-url-username</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-username">4.2. URL miscellaneous</a>
    <li><a href="#ref-for-concept-url-username①">4.3. URL writing</a>
    <li><a href="#ref-for-concept-url-username②">4.4. URL parsing</a> <a href="#ref-for-concept-url-username③">(2)</a> <a href="#ref-for-concept-url-username④">(3)</a> <a href="#ref-for-concept-url-username⑤">(4)</a> <a href="#ref-for-concept-url-username⑥">(5)</a> <a href="#ref-for-concept-url-username⑦">(6)</a> <a href="#ref-for-concept-url-username⑧">(7)</a> <a href="#ref-for-concept-url-username⑨">(8)</a> <a href="#ref-for-concept-url-username①⓪">(9)</a> <a href="#ref-for-concept-url-username①①">(10)</a> <a href="#ref-for-concept-url-username①②">(11)</a> <a href="#ref-for-concept-url-username①③">(12)</a> <a href="#ref-for-concept-url-username①④">(13)</a>
    <li><a href="#ref-for-concept-url-username①⑤">4.5. URL serializing</a>
    <li><a href="#ref-for-concept-url-username①⑥">4.8.1. Simplify non-human-readable or irrelevant components</a>
    <li><a href="#ref-for-concept-url-username①⑦">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url-password">
   <b><a href="#concept-url-password">#concept-url-password</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-password">4.2. URL miscellaneous</a>
    <li><a href="#ref-for-concept-url-password①">4.3. URL writing</a>
    <li><a href="#ref-for-concept-url-password②">4.4. URL parsing</a> <a href="#ref-for-concept-url-password③">(2)</a> <a href="#ref-for-concept-url-password④">(3)</a> <a href="#ref-for-concept-url-password⑤">(4)</a> <a href="#ref-for-concept-url-password⑥">(5)</a> <a href="#ref-for-concept-url-password⑦">(6)</a> <a href="#ref-for-concept-url-password⑧">(7)</a> <a href="#ref-for-concept-url-password⑨">(8)</a> <a href="#ref-for-concept-url-password①⓪">(9)</a> <a href="#ref-for-concept-url-password①①">(10)</a> <a href="#ref-for-concept-url-password①②">(11)</a> <a href="#ref-for-concept-url-password①③">(12)</a> <a href="#ref-for-concept-url-password①④">(13)</a>
    <li><a href="#ref-for-concept-url-password①⑤">4.5. URL serializing</a> <a href="#ref-for-concept-url-password①⑥">(2)</a>
    <li><a href="#ref-for-concept-url-password①⑦">4.8.1. Simplify non-human-readable or irrelevant components</a>
    <li><a href="#ref-for-concept-url-password①⑧">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url-host">
   <b><a href="#concept-url-host">#concept-url-host</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-host">4.1. URL representation</a> <a href="#ref-for-concept-url-host①">(2)</a>
    <li><a href="#ref-for-concept-url-host②">4.2. URL miscellaneous</a>
    <li><a href="#ref-for-concept-url-host③">4.3. URL writing</a> <a href="#ref-for-concept-url-host④">(2)</a>
    <li><a href="#ref-for-concept-url-host⑤">4.4. URL parsing</a> <a href="#ref-for-concept-url-host⑥">(2)</a> <a href="#ref-for-concept-url-host⑦">(3)</a> <a href="#ref-for-concept-url-host⑧">(4)</a> <a href="#ref-for-concept-url-host⑨">(5)</a> <a href="#ref-for-concept-url-host①⓪">(6)</a> <a href="#ref-for-concept-url-host①①">(7)</a> <a href="#ref-for-concept-url-host①②">(8)</a> <a href="#ref-for-concept-url-host①③">(9)</a> <a href="#ref-for-concept-url-host①④">(10)</a> <a href="#ref-for-concept-url-host①⑤">(11)</a> <a href="#ref-for-concept-url-host①⑥">(12)</a> <a href="#ref-for-concept-url-host①⑦">(13)</a> <a href="#ref-for-concept-url-host①⑧">(14)</a> <a href="#ref-for-concept-url-host①⑨">(15)</a> <a href="#ref-for-concept-url-host②⓪">(16)</a> <a href="#ref-for-concept-url-host②①">(17)</a> <a href="#ref-for-concept-url-host②②">(18)</a> <a href="#ref-for-concept-url-host②③">(19)</a> <a href="#ref-for-concept-url-host②④">(20)</a> <a href="#ref-for-concept-url-host②⑤">(21)</a> <a href="#ref-for-concept-url-host②⑥">(22)</a> <a href="#ref-for-concept-url-host②⑦">(23)</a> <a href="#ref-for-concept-url-host②⑧">(24)</a> <a href="#ref-for-concept-url-host②⑨">(25)</a> <a href="#ref-for-concept-url-host③⓪">(26)</a> <a href="#ref-for-concept-url-host③①">(27)</a> <a href="#ref-for-concept-url-host③②">(28)</a>
    <li><a href="#ref-for-concept-url-host③③">4.5. URL serializing</a> <a href="#ref-for-concept-url-host③④">(2)</a> <a href="#ref-for-concept-url-host③⑤">(3)</a>
    <li><a href="#ref-for-concept-url-host③⑥">4.7. Origin</a>
    <li><a href="#ref-for-concept-url-host③⑦">4.8.1. Simplify non-human-readable or irrelevant components</a> <a href="#ref-for-concept-url-host③⑧">(2)</a>
    <li><a href="#ref-for-concept-url-host③⑨">4.8.2. Elision</a>
    <li><a href="#ref-for-concept-url-host④⓪">4.8.3. Internationalization and special characters</a> <a href="#ref-for-concept-url-host④①">(2)</a>
    <li><a href="#ref-for-concept-url-host④②">6.1. URL class</a> <a href="#ref-for-concept-url-host④③">(2)</a> <a href="#ref-for-concept-url-host④④">(3)</a> <a href="#ref-for-concept-url-host④⑤">(4)</a> <a href="#ref-for-concept-url-host④⑥">(5)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url-port">
   <b><a href="#concept-url-port">#concept-url-port</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-port">4.2. URL miscellaneous</a> <a href="#ref-for-concept-url-port①">(2)</a>
    <li><a href="#ref-for-concept-url-port②">4.4. URL parsing</a> <a href="#ref-for-concept-url-port③">(2)</a> <a href="#ref-for-concept-url-port④">(3)</a> <a href="#ref-for-concept-url-port⑤">(4)</a> <a href="#ref-for-concept-url-port⑥">(5)</a> <a href="#ref-for-concept-url-port⑦">(6)</a> <a href="#ref-for-concept-url-port⑧">(7)</a> <a href="#ref-for-concept-url-port⑨">(8)</a> <a href="#ref-for-concept-url-port①⓪">(9)</a> <a href="#ref-for-concept-url-port①①">(10)</a> <a href="#ref-for-concept-url-port①②">(11)</a> <a href="#ref-for-concept-url-port①③">(12)</a> <a href="#ref-for-concept-url-port①④">(13)</a> <a href="#ref-for-concept-url-port①⑤">(14)</a> <a href="#ref-for-concept-url-port①⑥">(15)</a>
    <li><a href="#ref-for-concept-url-port①⑦">4.5. URL serializing</a> <a href="#ref-for-concept-url-port①⑧">(2)</a>
    <li><a href="#ref-for-concept-url-port①⑨">4.7. Origin</a>
    <li><a href="#ref-for-concept-url-port②⓪">6.1. URL class</a> <a href="#ref-for-concept-url-port②①">(2)</a> <a href="#ref-for-concept-url-port②②">(3)</a> <a href="#ref-for-concept-url-port②③">(4)</a> <a href="#ref-for-concept-url-port②④">(5)</a> <a href="#ref-for-concept-url-port②⑤">(6)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url-path">
   <b><a href="#concept-url-path">#concept-url-path</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-path">4.1. URL representation</a>
    <li><a href="#ref-for-concept-url-path①">4.2. URL miscellaneous</a>
    <li><a href="#ref-for-concept-url-path②">4.4. URL parsing</a> <a href="#ref-for-concept-url-path③">(2)</a> <a href="#ref-for-concept-url-path④">(3)</a> <a href="#ref-for-concept-url-path⑤">(4)</a> <a href="#ref-for-concept-url-path⑥">(5)</a> <a href="#ref-for-concept-url-path⑦">(6)</a> <a href="#ref-for-concept-url-path⑧">(7)</a> <a href="#ref-for-concept-url-path⑨">(8)</a> <a href="#ref-for-concept-url-path①⓪">(9)</a> <a href="#ref-for-concept-url-path①①">(10)</a> <a href="#ref-for-concept-url-path①②">(11)</a> <a href="#ref-for-concept-url-path①③">(12)</a> <a href="#ref-for-concept-url-path①④">(13)</a> <a href="#ref-for-concept-url-path①⑤">(14)</a> <a href="#ref-for-concept-url-path①⑥">(15)</a> <a href="#ref-for-concept-url-path①⑦">(16)</a> <a href="#ref-for-concept-url-path①⑧">(17)</a> <a href="#ref-for-concept-url-path①⑨">(18)</a> <a href="#ref-for-concept-url-path②⓪">(19)</a> <a href="#ref-for-concept-url-path②①">(20)</a> <a href="#ref-for-concept-url-path②②">(21)</a> <a href="#ref-for-concept-url-path②③">(22)</a> <a href="#ref-for-concept-url-path②④">(23)</a> <a href="#ref-for-concept-url-path②⑤">(24)</a> <a href="#ref-for-concept-url-path②⑥">(25)</a> <a href="#ref-for-concept-url-path②⑦">(26)</a> <a href="#ref-for-concept-url-path②⑧">(27)</a> <a href="#ref-for-concept-url-path②⑨">(28)</a> <a href="#ref-for-concept-url-path③⓪">(29)</a> <a href="#ref-for-concept-url-path③①">(30)</a> <a href="#ref-for-concept-url-path③②">(31)</a> <a href="#ref-for-concept-url-path③③">(32)</a> <a href="#ref-for-concept-url-path③④">(33)</a>
    <li><a href="#ref-for-concept-url-path③⑤">4.5. URL serializing</a> <a href="#ref-for-concept-url-path③⑥">(2)</a>
    <li><a href="#ref-for-concept-url-path③⑦">4.7. Origin</a>
    <li><a href="#ref-for-concept-url-path③⑧">4.8.1. Simplify non-human-readable or irrelevant components</a>
    <li><a href="#ref-for-concept-url-path③⑨">6.1. URL class</a> <a href="#ref-for-concept-url-path④⓪">(2)</a> <a href="#ref-for-concept-url-path④①">(3)</a> <a href="#ref-for-concept-url-path④②">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url-query">
   <b><a href="#concept-url-query">#concept-url-query</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-query">4.3. URL writing</a>
    <li><a href="#ref-for-concept-url-query①">4.4. URL parsing</a> <a href="#ref-for-concept-url-query②">(2)</a> <a href="#ref-for-concept-url-query③">(3)</a> <a href="#ref-for-concept-url-query④">(4)</a> <a href="#ref-for-concept-url-query⑤">(5)</a> <a href="#ref-for-concept-url-query⑥">(6)</a> <a href="#ref-for-concept-url-query⑦">(7)</a> <a href="#ref-for-concept-url-query⑧">(8)</a> <a href="#ref-for-concept-url-query⑨">(9)</a> <a href="#ref-for-concept-url-query①⓪">(10)</a> <a href="#ref-for-concept-url-query①①">(11)</a> <a href="#ref-for-concept-url-query①②">(12)</a> <a href="#ref-for-concept-url-query①③">(13)</a> <a href="#ref-for-concept-url-query①④">(14)</a> <a href="#ref-for-concept-url-query①⑤">(15)</a> <a href="#ref-for-concept-url-query①⑥">(16)</a> <a href="#ref-for-concept-url-query①⑦">(17)</a> <a href="#ref-for-concept-url-query①⑧">(18)</a>
    <li><a href="#ref-for-concept-url-query①⑨">4.5. URL serializing</a> <a href="#ref-for-concept-url-query②⓪">(2)</a>
    <li><a href="#ref-for-concept-url-query②①">6.1. URL class</a> <a href="#ref-for-concept-url-query②②">(2)</a> <a href="#ref-for-concept-url-query②③">(3)</a> <a href="#ref-for-concept-url-query②④">(4)</a> <a href="#ref-for-concept-url-query②⑤">(5)</a> <a href="#ref-for-concept-url-query②⑥">(6)</a>
    <li><a href="#ref-for-concept-url-query②⑦">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url-fragment">
   <b><a href="#concept-url-fragment">#concept-url-fragment</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-fragment">4.4. URL parsing</a> <a href="#ref-for-concept-url-fragment①">(2)</a> <a href="#ref-for-concept-url-fragment②">(3)</a> <a href="#ref-for-concept-url-fragment③">(4)</a> <a href="#ref-for-concept-url-fragment④">(5)</a> <a href="#ref-for-concept-url-fragment⑤">(6)</a> <a href="#ref-for-concept-url-fragment⑥">(7)</a> <a href="#ref-for-concept-url-fragment⑦">(8)</a>
    <li><a href="#ref-for-concept-url-fragment⑧">4.5. URL serializing</a> <a href="#ref-for-concept-url-fragment⑨">(2)</a>
    <li><a href="#ref-for-concept-url-fragment①⓪">6.1. URL class</a> <a href="#ref-for-concept-url-fragment①①">(2)</a> <a href="#ref-for-concept-url-fragment①②">(3)</a> <a href="#ref-for-concept-url-fragment①③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="url-cannot-be-a-base-url-flag">
   <b><a href="#url-cannot-be-a-base-url-flag">#url-cannot-be-a-base-url-flag</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-url-cannot-be-a-base-url-flag">4.2. URL miscellaneous</a>
    <li><a href="#ref-for-url-cannot-be-a-base-url-flag①">4.4. URL parsing</a> <a href="#ref-for-url-cannot-be-a-base-url-flag②">(2)</a> <a href="#ref-for-url-cannot-be-a-base-url-flag③">(3)</a> <a href="#ref-for-url-cannot-be-a-base-url-flag④">(4)</a> <a href="#ref-for-url-cannot-be-a-base-url-flag⑤">(5)</a>
    <li><a href="#ref-for-url-cannot-be-a-base-url-flag⑥">4.5. URL serializing</a>
    <li><a href="#ref-for-url-cannot-be-a-base-url-flag⑦">6.1. URL class</a> <a href="#ref-for-url-cannot-be-a-base-url-flag⑧">(2)</a> <a href="#ref-for-url-cannot-be-a-base-url-flag⑨">(3)</a> <a href="#ref-for-url-cannot-be-a-base-url-flag①⓪">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url-blob-entry">
   <b><a href="#concept-url-blob-entry">#concept-url-blob-entry</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-blob-entry">4.4. URL parsing</a>
    <li><a href="#ref-for-concept-url-blob-entry①">4.7. Origin</a> <a href="#ref-for-concept-url-blob-entry②">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="special-scheme">
   <b><a href="#special-scheme">#special-scheme</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-special-scheme">4.1. URL representation</a> <a href="#ref-for-special-scheme①">(2)</a>
    <li><a href="#ref-for-special-scheme②">4.2. URL miscellaneous</a> <a href="#ref-for-special-scheme③">(2)</a> <a href="#ref-for-special-scheme④">(3)</a>
    <li><a href="#ref-for-special-scheme⑤">4.3. URL writing</a> <a href="#ref-for-special-scheme⑥">(2)</a> <a href="#ref-for-special-scheme⑦">(3)</a>
    <li><a href="#ref-for-special-scheme⑧">4.4. URL parsing</a> <a href="#ref-for-special-scheme⑨">(2)</a> <a href="#ref-for-special-scheme①⓪">(3)</a> <a href="#ref-for-special-scheme①①">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="default-port">
   <b><a href="#default-port">#default-port</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-default-port">4.4. URL parsing</a> <a href="#ref-for-default-port①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="is-special">
   <b><a href="#is-special">#is-special</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-is-special">4.1. URL representation</a>
    <li><a href="#ref-for-is-special①">4.4. URL parsing</a> <a href="#ref-for-is-special②">(2)</a> <a href="#ref-for-is-special③">(3)</a> <a href="#ref-for-is-special④">(4)</a> <a href="#ref-for-is-special⑤">(5)</a> <a href="#ref-for-is-special⑥">(6)</a> <a href="#ref-for-is-special⑦">(7)</a> <a href="#ref-for-is-special⑧">(8)</a> <a href="#ref-for-is-special⑨">(9)</a> <a href="#ref-for-is-special①⓪">(10)</a> <a href="#ref-for-is-special①①">(11)</a> <a href="#ref-for-is-special①②">(12)</a> <a href="#ref-for-is-special①③">(13)</a> <a href="#ref-for-is-special①④">(14)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="is-not-special">
   <b><a href="#is-not-special">#is-not-special</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-is-not-special">4.4. URL parsing</a> <a href="#ref-for-is-not-special①">(2)</a> <a href="#ref-for-is-not-special②">(3)</a> <a href="#ref-for-is-not-special③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="include-credentials">
   <b><a href="#include-credentials">#include-credentials</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-include-credentials">4.4. URL parsing</a> <a href="#ref-for-include-credentials①">(2)</a>
    <li><a href="#ref-for-include-credentials②">4.5. URL serializing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="cannot-have-a-username-password-port">
   <b><a href="#cannot-have-a-username-password-port">#cannot-have-a-username-password-port</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-cannot-have-a-username-password-port">6.1. URL class</a> <a href="#ref-for-cannot-have-a-username-password-port①">(2)</a> <a href="#ref-for-cannot-have-a-username-password-port②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-base-url">
   <b><a href="#concept-base-url">#concept-base-url</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-base-url">4.2. URL miscellaneous</a>
    <li><a href="#ref-for-concept-base-url①">4.3. URL writing</a> <a href="#ref-for-concept-base-url②">(2)</a> <a href="#ref-for-concept-base-url③">(3)</a> <a href="#ref-for-concept-base-url④">(4)</a>
    <li><a href="#ref-for-concept-base-url⑤">4.4. URL parsing</a> <a href="#ref-for-concept-base-url⑥">(2)</a>
    <li><a href="#ref-for-concept-base-url⑦">6.1. URL class</a> <a href="#ref-for-concept-base-url⑧">(2)</a> <a href="#ref-for-concept-base-url⑨">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="windows-drive-letter">
   <b><a href="#windows-drive-letter">#windows-drive-letter</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-windows-drive-letter">4.2. URL miscellaneous</a> <a href="#ref-for-windows-drive-letter①">(2)</a>
    <li><a href="#ref-for-windows-drive-letter②">4.3. URL writing</a>
    <li><a href="#ref-for-windows-drive-letter③">4.4. URL parsing</a> <a href="#ref-for-windows-drive-letter④">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="normalized-windows-drive-letter">
   <b><a href="#normalized-windows-drive-letter">#normalized-windows-drive-letter</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-normalized-windows-drive-letter">4.2. URL miscellaneous</a> <a href="#ref-for-normalized-windows-drive-letter①">(2)</a>
    <li><a href="#ref-for-normalized-windows-drive-letter②">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="start-with-a-windows-drive-letter">
   <b><a href="#start-with-a-windows-drive-letter">#start-with-a-windows-drive-letter</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-start-with-a-windows-drive-letter">4.4. URL parsing</a> <a href="#ref-for-start-with-a-windows-drive-letter①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="shorten-a-urls-path">
   <b><a href="#shorten-a-urls-path">#shorten-a-urls-path</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-shorten-a-urls-path">4.4. URL parsing</a> <a href="#ref-for-shorten-a-urls-path①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valid-url-string">
   <b><a href="#valid-url-string">#valid-url-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valid-url-string">4. URLs</a> <a href="#ref-for-valid-url-string①">(2)</a>
    <li><a href="#ref-for-valid-url-string②">4.1. URL representation</a>
    <li><a href="#ref-for-valid-url-string③">4.3. URL writing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="absolute-url-with-fragment-string">
   <b><a href="#absolute-url-with-fragment-string">#absolute-url-with-fragment-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-absolute-url-with-fragment-string">4.3. URL writing</a>
    <li><a href="#ref-for-absolute-url-with-fragment-string①">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="absolute-url-string">
   <b><a href="#absolute-url-string">#absolute-url-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-absolute-url-string">4.3. URL writing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="url-scheme-string">
   <b><a href="#url-scheme-string">#url-scheme-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-url-scheme-string">4.3. URL writing</a> <a href="#ref-for-url-scheme-string①">(2)</a> <a href="#ref-for-url-scheme-string②">(3)</a> <a href="#ref-for-url-scheme-string③">(4)</a> <a href="#ref-for-url-scheme-string④">(5)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="relative-url-with-fragment-string">
   <b><a href="#relative-url-with-fragment-string">#relative-url-with-fragment-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-relative-url-with-fragment-string">4.3. URL writing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="relative-url-string">
   <b><a href="#relative-url-string">#relative-url-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-relative-url-string">4.2. URL miscellaneous</a>
    <li><a href="#ref-for-relative-url-string①">4.3. URL writing</a> <a href="#ref-for-relative-url-string②">(2)</a> <a href="#ref-for-relative-url-string③">(3)</a>
    <li><a href="#ref-for-relative-url-string④">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="scheme-relative-special-url-string">
   <b><a href="#scheme-relative-special-url-string">#scheme-relative-special-url-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-scheme-relative-special-url-string">4.3. URL writing</a> <a href="#ref-for-scheme-relative-special-url-string①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="url-port-string">
   <b><a href="#url-port-string">#url-port-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-url-port-string">4.3. URL writing</a> <a href="#ref-for-url-port-string①">(2)</a>
    <li><a href="#ref-for-url-port-string②">6.1. URL class</a> <a href="#ref-for-url-port-string③">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="scheme-relative-url-string">
   <b><a href="#scheme-relative-url-string">#scheme-relative-url-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-scheme-relative-url-string">4.3. URL writing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="opaque-host-and-port-string">
   <b><a href="#opaque-host-and-port-string">#opaque-host-and-port-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-opaque-host-and-port-string">4.3. URL writing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="scheme-relative-file-url-string">
   <b><a href="#scheme-relative-file-url-string">#scheme-relative-file-url-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-scheme-relative-file-url-string">4.3. URL writing</a> <a href="#ref-for-scheme-relative-file-url-string①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="path-absolute-url-string">
   <b><a href="#path-absolute-url-string">#path-absolute-url-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-path-absolute-url-string">4.3. URL writing</a> <a href="#ref-for-path-absolute-url-string①">(2)</a> <a href="#ref-for-path-absolute-url-string②">(3)</a> <a href="#ref-for-path-absolute-url-string③">(4)</a> <a href="#ref-for-path-absolute-url-string④">(5)</a> <a href="#ref-for-path-absolute-url-string⑤">(6)</a> <a href="#ref-for-path-absolute-url-string⑥">(7)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="path-absolute-non-windows-file-url-string">
   <b><a href="#path-absolute-non-windows-file-url-string">#path-absolute-non-windows-file-url-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-path-absolute-non-windows-file-url-string">4.3. URL writing</a> <a href="#ref-for-path-absolute-non-windows-file-url-string①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="path-relative-url-string">
   <b><a href="#path-relative-url-string">#path-relative-url-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-path-relative-url-string">4.3. URL writing</a> <a href="#ref-for-path-relative-url-string①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="path-relative-scheme-less-url-string">
   <b><a href="#path-relative-scheme-less-url-string">#path-relative-scheme-less-url-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-path-relative-scheme-less-url-string">4.3. URL writing</a> <a href="#ref-for-path-relative-scheme-less-url-string①">(2)</a> <a href="#ref-for-path-relative-scheme-less-url-string②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="url-path-segment-string">
   <b><a href="#url-path-segment-string">#url-path-segment-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-url-path-segment-string">4.3. URL writing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="single-dot-path-segment">
   <b><a href="#single-dot-path-segment">#single-dot-path-segment</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-single-dot-path-segment">4.3. URL writing</a> <a href="#ref-for-single-dot-path-segment①">(2)</a>
    <li><a href="#ref-for-single-dot-path-segment②">4.4. URL parsing</a> <a href="#ref-for-single-dot-path-segment③">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="double-dot-path-segment">
   <b><a href="#double-dot-path-segment">#double-dot-path-segment</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-double-dot-path-segment">4.3. URL writing</a> <a href="#ref-for-double-dot-path-segment①">(2)</a>
    <li><a href="#ref-for-double-dot-path-segment②">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="url-query-string">
   <b><a href="#url-query-string">#url-query-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-url-query-string">4.3. URL writing</a> <a href="#ref-for-url-query-string①">(2)</a> <a href="#ref-for-url-query-string②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="url-fragment-string">
   <b><a href="#url-fragment-string">#url-fragment-string</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-url-fragment-string">4.3. URL writing</a> <a href="#ref-for-url-fragment-string①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="url-code-points">
   <b><a href="#url-code-points">#url-code-points</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-url-code-points">4.3. URL writing</a> <a href="#ref-for-url-code-points①">(2)</a>
    <li><a href="#ref-for-url-code-points②">4.4. URL parsing</a> <a href="#ref-for-url-code-points③">(2)</a> <a href="#ref-for-url-code-points④">(3)</a> <a href="#ref-for-url-code-points⑤">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="url-units">
   <b><a href="#url-units">#url-units</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-url-units">3.4. Host writing</a>
    <li><a href="#ref-for-url-units①">4.3. URL writing</a> <a href="#ref-for-url-units②">(2)</a> <a href="#ref-for-url-units③">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url-parser">
   <b><a href="#concept-url-parser">#concept-url-parser</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-parser">4. URLs</a> <a href="#ref-for-concept-url-parser①">(2)</a> <a href="#ref-for-concept-url-parser②">(3)</a> <a href="#ref-for-concept-url-parser③">(4)</a>
    <li><a href="#ref-for-concept-url-parser④">4.1. URL representation</a>
    <li><a href="#ref-for-concept-url-parser⑤">4.2. URL miscellaneous</a>
    <li><a href="#ref-for-concept-url-parser⑥">4.3. URL writing</a> <a href="#ref-for-concept-url-parser⑦">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-basic-url-parser">
   <b><a href="#concept-basic-url-parser">#concept-basic-url-parser</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-basic-url-parser">4.4. URL parsing</a> <a href="#ref-for-concept-basic-url-parser①">(2)</a> <a href="#ref-for-concept-basic-url-parser②">(3)</a>
    <li><a href="#ref-for-concept-basic-url-parser③">4.7. Origin</a>
    <li><a href="#ref-for-concept-basic-url-parser④">6.1. URL class</a> <a href="#ref-for-concept-basic-url-parser⑤">(2)</a> <a href="#ref-for-concept-basic-url-parser⑥">(3)</a> <a href="#ref-for-concept-basic-url-parser⑦">(4)</a> <a href="#ref-for-concept-basic-url-parser⑧">(5)</a> <a href="#ref-for-concept-basic-url-parser⑨">(6)</a> <a href="#ref-for-concept-basic-url-parser①⓪">(7)</a> <a href="#ref-for-concept-basic-url-parser①①">(8)</a> <a href="#ref-for-concept-basic-url-parser①②">(9)</a> <a href="#ref-for-concept-basic-url-parser①③">(10)</a> <a href="#ref-for-concept-basic-url-parser①④">(11)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="scheme-start-state">
   <b><a href="#scheme-start-state">#scheme-start-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-scheme-start-state">4.4. URL parsing</a>
    <li><a href="#ref-for-scheme-start-state①">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="scheme-state">
   <b><a href="#scheme-state">#scheme-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-scheme-state">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="no-scheme-state">
   <b><a href="#no-scheme-state">#no-scheme-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-no-scheme-state">4.4. URL parsing</a> <a href="#ref-for-no-scheme-state①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="special-relative-or-authority-state">
   <b><a href="#special-relative-or-authority-state">#special-relative-or-authority-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-special-relative-or-authority-state">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="path-or-authority-state">
   <b><a href="#path-or-authority-state">#path-or-authority-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-path-or-authority-state">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="relative-state">
   <b><a href="#relative-state">#relative-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-relative-state">4.4. URL parsing</a> <a href="#ref-for-relative-state①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="relative-slash-state">
   <b><a href="#relative-slash-state">#relative-slash-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-relative-slash-state">4.4. URL parsing</a> <a href="#ref-for-relative-slash-state①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="special-authority-slashes-state">
   <b><a href="#special-authority-slashes-state">#special-authority-slashes-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-special-authority-slashes-state">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="special-authority-ignore-slashes-state">
   <b><a href="#special-authority-ignore-slashes-state">#special-authority-ignore-slashes-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-special-authority-ignore-slashes-state">4.4. URL parsing</a> <a href="#ref-for-special-authority-ignore-slashes-state①">(2)</a> <a href="#ref-for-special-authority-ignore-slashes-state②">(3)</a> <a href="#ref-for-special-authority-ignore-slashes-state③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="authority-state">
   <b><a href="#authority-state">#authority-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-authority-state">4.4. URL parsing</a> <a href="#ref-for-authority-state①">(2)</a> <a href="#ref-for-authority-state②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="host-state">
   <b><a href="#host-state">#host-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-host-state">4.4. URL parsing</a>
    <li><a href="#ref-for-host-state①">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="hostname-state">
   <b><a href="#hostname-state">#hostname-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-hostname-state">4.4. URL parsing</a>
    <li><a href="#ref-for-hostname-state①">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="port-state">
   <b><a href="#port-state">#port-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-port-state">4.4. URL parsing</a>
    <li><a href="#ref-for-port-state①">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="file-state">
   <b><a href="#file-state">#file-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-file-state">4.4. URL parsing</a> <a href="#ref-for-file-state①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="file-slash-state">
   <b><a href="#file-slash-state">#file-slash-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-file-slash-state">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="file-host-state">
   <b><a href="#file-host-state">#file-host-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-file-host-state">4.4. URL parsing</a> <a href="#ref-for-file-host-state①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="path-start-state">
   <b><a href="#path-start-state">#path-start-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-path-start-state">4.4. URL parsing</a> <a href="#ref-for-path-start-state①">(2)</a> <a href="#ref-for-path-start-state②">(3)</a> <a href="#ref-for-path-start-state③">(4)</a>
    <li><a href="#ref-for-path-start-state④">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="path-state">
   <b><a href="#path-state">#path-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-path-state">4.4. URL parsing</a> <a href="#ref-for-path-state①">(2)</a> <a href="#ref-for-path-state②">(3)</a> <a href="#ref-for-path-state③">(4)</a> <a href="#ref-for-path-state④">(5)</a> <a href="#ref-for-path-state⑤">(6)</a> <a href="#ref-for-path-state⑥">(7)</a> <a href="#ref-for-path-state⑦">(8)</a> <a href="#ref-for-path-state⑧">(9)</a> <a href="#ref-for-path-state⑨">(10)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="cannot-be-a-base-url-path-state">
   <b><a href="#cannot-be-a-base-url-path-state">#cannot-be-a-base-url-path-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-cannot-be-a-base-url-path-state">4.4. URL parsing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="query-state">
   <b><a href="#query-state">#query-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-query-state">4.4. URL parsing</a> <a href="#ref-for-query-state①">(2)</a> <a href="#ref-for-query-state②">(3)</a> <a href="#ref-for-query-state③">(4)</a> <a href="#ref-for-query-state④">(5)</a>
    <li><a href="#ref-for-query-state⑤">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="fragment-state">
   <b><a href="#fragment-state">#fragment-state</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-fragment-state">4.4. URL parsing</a> <a href="#ref-for-fragment-state①">(2)</a> <a href="#ref-for-fragment-state②">(3)</a> <a href="#ref-for-fragment-state③">(4)</a> <a href="#ref-for-fragment-state④">(5)</a> <a href="#ref-for-fragment-state⑤">(6)</a> <a href="#ref-for-fragment-state⑥">(7)</a>
    <li><a href="#ref-for-fragment-state⑦">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="set-the-username">
   <b><a href="#set-the-username">#set-the-username</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-set-the-username">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="set-the-password">
   <b><a href="#set-the-password">#set-the-password</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-set-the-password">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url-serializer">
   <b><a href="#concept-url-serializer">#concept-url-serializer</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-serializer">4. URLs</a> <a href="#ref-for-concept-url-serializer①">(2)</a> <a href="#ref-for-concept-url-serializer②">(3)</a> <a href="#ref-for-concept-url-serializer③">(4)</a>
    <li><a href="#ref-for-concept-url-serializer④">4.6. URL equivalence</a> <a href="#ref-for-concept-url-serializer⑤">(2)</a>
    <li><a href="#ref-for-concept-url-serializer⑥">4.8. URL rendering</a>
    <li><a href="#ref-for-concept-url-serializer⑦">6.1. URL class</a>
    <li><a href="#ref-for-concept-url-serializer⑧">6.3. URL APIs elsewhere</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url-equals">
   <b><a href="#concept-url-equals">#concept-url-equals</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-equals">4. URLs</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url-origin">
   <b><a href="#concept-url-origin">#concept-url-origin</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-origin">4.7. Origin</a> <a href="#ref-for-concept-url-origin①">(2)</a>
    <li><a href="#ref-for-concept-url-origin②">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-urlencoded-parser">
   <b><a href="#concept-urlencoded-parser">#concept-urlencoded-parser</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-urlencoded-parser">5.3. Hooks</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-urlencoded-byte-serializer">
   <b><a href="#concept-urlencoded-byte-serializer">#concept-urlencoded-byte-serializer</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-urlencoded-byte-serializer">5.2. application/x-www-form-urlencoded serializing</a> <a href="#ref-for-concept-urlencoded-byte-serializer①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-urlencoded-serializer">
   <b><a href="#concept-urlencoded-serializer">#concept-urlencoded-serializer</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-urlencoded-serializer">6.2. URLSearchParams class</a> <a href="#ref-for-concept-urlencoded-serializer①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-urlencoded-string-parser">
   <b><a href="#concept-urlencoded-string-parser">#concept-urlencoded-string-parser</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-urlencoded-string-parser">6.1. URL class</a> <a href="#ref-for-concept-urlencoded-string-parser①">(2)</a>
    <li><a href="#ref-for-concept-urlencoded-string-parser②">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="url">
   <b><a href="#url">#url</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-url">Goals</a>
    <li><a href="#ref-for-url①">6.1. URL class</a> <a href="#ref-for-url②">(2)</a> <a href="#ref-for-url③">(3)</a> <a href="#ref-for-url④">(4)</a> <a href="#ref-for-url⑤">(5)</a>
    <li><a href="#ref-for-url⑥">6.3. URL APIs elsewhere</a> <a href="#ref-for-url⑦">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url-url">
   <b><a href="#concept-url-url">#concept-url-url</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-url">6.1. URL class</a> <a href="#ref-for-concept-url-url①">(2)</a> <a href="#ref-for-concept-url-url②">(3)</a> <a href="#ref-for-concept-url-url③">(4)</a> <a href="#ref-for-concept-url-url④">(5)</a> <a href="#ref-for-concept-url-url⑤">(6)</a> <a href="#ref-for-concept-url-url⑥">(7)</a> <a href="#ref-for-concept-url-url⑦">(8)</a> <a href="#ref-for-concept-url-url⑧">(9)</a> <a href="#ref-for-concept-url-url⑨">(10)</a> <a href="#ref-for-concept-url-url①⓪">(11)</a> <a href="#ref-for-concept-url-url①①">(12)</a> <a href="#ref-for-concept-url-url①②">(13)</a> <a href="#ref-for-concept-url-url①③">(14)</a> <a href="#ref-for-concept-url-url①④">(15)</a> <a href="#ref-for-concept-url-url①⑤">(16)</a> <a href="#ref-for-concept-url-url①⑥">(17)</a> <a href="#ref-for-concept-url-url①⑦">(18)</a> <a href="#ref-for-concept-url-url①⑧">(19)</a> <a href="#ref-for-concept-url-url①⑨">(20)</a> <a href="#ref-for-concept-url-url②⓪">(21)</a> <a href="#ref-for-concept-url-url②①">(22)</a> <a href="#ref-for-concept-url-url②②">(23)</a> <a href="#ref-for-concept-url-url②③">(24)</a> <a href="#ref-for-concept-url-url②④">(25)</a> <a href="#ref-for-concept-url-url②⑤">(26)</a> <a href="#ref-for-concept-url-url②⑥">(27)</a> <a href="#ref-for-concept-url-url②⑦">(28)</a> <a href="#ref-for-concept-url-url②⑧">(29)</a> <a href="#ref-for-concept-url-url②⑨">(30)</a> <a href="#ref-for-concept-url-url③⓪">(31)</a> <a href="#ref-for-concept-url-url③①">(32)</a> <a href="#ref-for-concept-url-url③②">(33)</a> <a href="#ref-for-concept-url-url③③">(34)</a> <a href="#ref-for-concept-url-url③④">(35)</a> <a href="#ref-for-concept-url-url③⑤">(36)</a> <a href="#ref-for-concept-url-url③⑥">(37)</a> <a href="#ref-for-concept-url-url③⑦">(38)</a> <a href="#ref-for-concept-url-url③⑧">(39)</a> <a href="#ref-for-concept-url-url③⑨">(40)</a> <a href="#ref-for-concept-url-url④⓪">(41)</a>
    <li><a href="#ref-for-concept-url-url④①">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-url-query-object">
   <b><a href="#concept-url-query-object">#concept-url-query-object</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-url-query-object">6.1. URL class</a> <a href="#ref-for-concept-url-query-object①">(2)</a> <a href="#ref-for-concept-url-query-object②">(3)</a> <a href="#ref-for-concept-url-query-object③">(4)</a> <a href="#ref-for-concept-url-query-object④">(5)</a> <a href="#ref-for-concept-url-query-object⑤">(6)</a> <a href="#ref-for-concept-url-query-object⑥">(7)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-url-url">
   <b><a href="#dom-url-url">#dom-url-url</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-url-url">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-url-href">
   <b><a href="#dom-url-href">#dom-url-href</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-url-href">6.1. URL class</a> <a href="#ref-for-dom-url-href①">(2)</a> <a href="#ref-for-dom-url-href②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-url-tojson">
   <b><a href="#dom-url-tojson">#dom-url-tojson</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-url-tojson">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-url-origin">
   <b><a href="#dom-url-origin">#dom-url-origin</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-url-origin">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-url-protocol">
   <b><a href="#dom-url-protocol">#dom-url-protocol</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-url-protocol">6.1. URL class</a> <a href="#ref-for-dom-url-protocol①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-url-username">
   <b><a href="#dom-url-username">#dom-url-username</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-url-username">6.1. URL class</a> <a href="#ref-for-dom-url-username①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-url-password">
   <b><a href="#dom-url-password">#dom-url-password</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-url-password">6.1. URL class</a> <a href="#ref-for-dom-url-password①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-url-host">
   <b><a href="#dom-url-host">#dom-url-host</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-url-host">6.1. URL class</a> <a href="#ref-for-dom-url-host①">(2)</a> <a href="#ref-for-dom-url-host②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-url-hostname">
   <b><a href="#dom-url-hostname">#dom-url-hostname</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-url-hostname">6.1. URL class</a> <a href="#ref-for-dom-url-hostname①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-url-port">
   <b><a href="#dom-url-port">#dom-url-port</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-url-port">6.1. URL class</a> <a href="#ref-for-dom-url-port①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-url-pathname">
   <b><a href="#dom-url-pathname">#dom-url-pathname</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-url-pathname">6.1. URL class</a> <a href="#ref-for-dom-url-pathname①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-url-search">
   <b><a href="#dom-url-search">#dom-url-search</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-url-search">6.1. URL class</a> <a href="#ref-for-dom-url-search①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-url-searchparams">
   <b><a href="#dom-url-searchparams">#dom-url-searchparams</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-url-searchparams">6.1. URL class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-url-hash">
   <b><a href="#dom-url-hash">#dom-url-hash</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-url-hash">6.1. URL class</a> <a href="#ref-for-dom-url-hash①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="urlsearchparams">
   <b><a href="#urlsearchparams">#urlsearchparams</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-urlsearchparams">6.1. URL class</a> <a href="#ref-for-urlsearchparams①">(2)</a> <a href="#ref-for-urlsearchparams②">(3)</a>
    <li><a href="#ref-for-urlsearchparams③">6.2. URLSearchParams class</a> <a href="#ref-for-urlsearchparams④">(2)</a> <a href="#ref-for-urlsearchparams⑤">(3)</a> <a href="#ref-for-urlsearchparams⑥">(4)</a> <a href="#ref-for-urlsearchparams⑦">(5)</a> <a href="#ref-for-urlsearchparams⑧">(6)</a> <a href="#ref-for-urlsearchparams⑨">(7)</a> <a href="#ref-for-urlsearchparams①⓪">(8)</a> <a href="#ref-for-urlsearchparams①①">(9)</a> <a href="#ref-for-urlsearchparams①②">(10)</a> <a href="#ref-for-urlsearchparams①③">(11)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-urlsearchparams-list">
   <b><a href="#concept-urlsearchparams-list">#concept-urlsearchparams-list</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-urlsearchparams-list">6.1. URL class</a> <a href="#ref-for-concept-urlsearchparams-list①">(2)</a> <a href="#ref-for-concept-urlsearchparams-list②">(3)</a> <a href="#ref-for-concept-urlsearchparams-list③">(4)</a>
    <li><a href="#ref-for-concept-urlsearchparams-list④">6.2. URLSearchParams class</a> <a href="#ref-for-concept-urlsearchparams-list⑤">(2)</a> <a href="#ref-for-concept-urlsearchparams-list⑥">(3)</a> <a href="#ref-for-concept-urlsearchparams-list⑦">(4)</a> <a href="#ref-for-concept-urlsearchparams-list⑧">(5)</a> <a href="#ref-for-concept-urlsearchparams-list⑨">(6)</a> <a href="#ref-for-concept-urlsearchparams-list①⓪">(7)</a> <a href="#ref-for-concept-urlsearchparams-list①①">(8)</a> <a href="#ref-for-concept-urlsearchparams-list①②">(9)</a> <a href="#ref-for-concept-urlsearchparams-list①③">(10)</a> <a href="#ref-for-concept-urlsearchparams-list①④">(11)</a> <a href="#ref-for-concept-urlsearchparams-list①⑤">(12)</a> <a href="#ref-for-concept-urlsearchparams-list①⑥">(13)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-urlsearchparams-url-object">
   <b><a href="#concept-urlsearchparams-url-object">#concept-urlsearchparams-url-object</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-urlsearchparams-url-object">6.1. URL class</a>
    <li><a href="#ref-for-concept-urlsearchparams-url-object①">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-urlsearchparams-new">
   <b><a href="#concept-urlsearchparams-new">#concept-urlsearchparams-new</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-urlsearchparams-new">6.1. URL class</a>
    <li><a href="#ref-for-concept-urlsearchparams-new①">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="concept-urlsearchparams-update">
   <b><a href="#concept-urlsearchparams-update">#concept-urlsearchparams-update</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-concept-urlsearchparams-update">6.2. URLSearchParams class</a> <a href="#ref-for-concept-urlsearchparams-update①">(2)</a> <a href="#ref-for-concept-urlsearchparams-update②">(3)</a> <a href="#ref-for-concept-urlsearchparams-update③">(4)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-urlsearchparams-urlsearchparams">
   <b><a href="#dom-urlsearchparams-urlsearchparams">#dom-urlsearchparams-urlsearchparams</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-urlsearchparams-urlsearchparams">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-urlsearchparams-append">
   <b><a href="#dom-urlsearchparams-append">#dom-urlsearchparams-append</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-urlsearchparams-append">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-urlsearchparams-delete">
   <b><a href="#dom-urlsearchparams-delete">#dom-urlsearchparams-delete</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-urlsearchparams-delete">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-urlsearchparams-get">
   <b><a href="#dom-urlsearchparams-get">#dom-urlsearchparams-get</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-urlsearchparams-get">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-urlsearchparams-getall">
   <b><a href="#dom-urlsearchparams-getall">#dom-urlsearchparams-getall</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-urlsearchparams-getall">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-urlsearchparams-has">
   <b><a href="#dom-urlsearchparams-has">#dom-urlsearchparams-has</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-urlsearchparams-has">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-urlsearchparams-set">
   <b><a href="#dom-urlsearchparams-set">#dom-urlsearchparams-set</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-urlsearchparams-set">6.2. URLSearchParams class</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="dom-urlsearchparams-sort">
   <b><a href="#dom-urlsearchparams-sort">#dom-urlsearchparams-sort</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-dom-urlsearchparams-sort">6.2. URLSearchParams class</a> <a href="#ref-for-dom-urlsearchparams-sort①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="urlsearchparams-stringification-behavior">
   <b><a href="#urlsearchparams-stringification-behavior">#urlsearchparams-stringification-behavior</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-urlsearchparams-stringification-behavior">6.2. URLSearchParams class</a>
   </ul>
  </aside>
<script>/* script-dfn-panel */

document.body.addEventListener("click", function(e) {
    var queryAll = function(sel) { return [].slice.call(document.querySelectorAll(sel)); }
    // Find the dfn element or panel, if any, that was clicked on.
    var el = e.target;
    var target;
    var hitALink = false;
    while(el.parentElement) {
        if(el.tagName == "A") {
            // Clicking on a link in a <dfn> shouldn't summon the panel
            hitALink = true;
        }
        if(el.classList.contains("dfn-paneled")) {
            target = "dfn";
            break;
        }
        if(el.classList.contains("dfn-panel")) {
            target = "dfn-panel";
            break;
        }
        el = el.parentElement;
    }
    if(target != "dfn-panel") {
        // Turn off any currently "on" or "activated" panels.
        queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(function(el){
            el.classList.remove("on");
            el.classList.remove("activated");
        });
    }
    if(target == "dfn" && !hitALink) {
        // open the panel
        var dfnPanel = document.querySelector(".dfn-panel[data-for='" + el.id + "']");
        if(dfnPanel) {
            dfnPanel.classList.add("on");
            var rect = el.getBoundingClientRect();
            dfnPanel.style.left = window.scrollX + rect.right + 5 + "px";
            dfnPanel.style.top = window.scrollY + rect.top + "px";
            var panelRect = dfnPanel.getBoundingClientRect();
            var panelWidth = panelRect.right - panelRect.left;
            if(panelRect.right > document.body.scrollWidth && (rect.left - (panelWidth + 5)) > 0) {
                // Reposition, because the panel is overflowing
                dfnPanel.style.left = window.scrollX + rect.left - (panelWidth + 5) + "px";
            }
        } else {
            console.log("Couldn't find .dfn-panel[data-for='" + el.id + "']");
        }
    } else if(target == "dfn-panel") {
        // Switch it to "activated" state, which pins it.
        el.classList.add("activated");
        el.style.left = null;
        el.style.top = null;
    }

});
</script>